thinkingc / blog Goto Github PK
View Code? Open in Web Editor NEWmy blog
my blog
HEAD、master 与 branch
[Git从入门到熟练使用](https://www.jianshu.com/p/e1a981eec3d3)
Git教程
PR:https://blog.csdn.net/qq_33429968/article/details/62219783
在fb之外的分支:git fetch origin fb:fb
git checkout fb
git rebase -i xxx
git push my fb:fb -f
git fetch origin master:master (此时source branch 对应的target branch应该是0个Commits)
git checkout master
git cherry-pick commitid(rebase后仅剩的一个commitid)
git add .; git cherry-pick --continue (conflict时)
git push my master
git checkout -b 本地分支名x origin/远程分支名x
使用该方式会在本地新建分支x,并自动切换到该本地分支x。
采用此种方法建立的本地分支会和远程分支建立映射关系。
如果不想建立映射关系,可以:
git fetch origin 远程分支名x:本地分支名x
使用该方式会在本地新建分支x,但是不会自动切换到该本地分支x,需要手动checkout。
【新建文件必须git add .】
在 Git 中整合来自不同分支的修改主要有两种方法:merge 以及 rebase。(即解决冲突)
先建个masterd bug的分支,解决好提交后...
(1.)如果有冲突, 解决冲突
git add .
不需要commit
git rebase --continue
git push 到远端
git rebase:处理我们的commit信息(合并某几次、修改某一次):https://blog.csdn.net/tangkegagalikaiwu/article/details/8542827/
git rebase:git rebase 可以帮助项目中的commit提交历史干净整洁!!!
git rebase -i HEAD~4 // 修改第2-4行的第一个单词pick为squash
git reset:重置stage区和工作目录。https://www.jianshu.com/p/c2ec5f06cf1a
git reset --hard commitid // 回退到指定版本
git reset --hard HEAD~2 // 回退2个版本 (HEAD:当前 commit 的引用)
git reset --hard origin/master // 放弃所有修改(commit),完全同步远程仓库
解决冲突:
git add .
git rebase --continue
git fetch –all //只是下载代码到本地,不进行合并操作 - $ git fetch <远程主机名> <分支名> //注意之间有空格
git reset –hard origin/master //把HEAD指向最新下载的版本
// 类似上面
git fetch origin master //从远程主机的master分支拉取最新内容
git merge FETCH_HEAD //将拉取下来的最新内容合并到当前所在的分支中
https://juejin.im/post/5d3685146fb9a07ed064f11b
很明显此时远程分支有新的 commit 未同步到本地,无法推送
$ git pull <远程主机名> <远程分支名>:<本地分支名>
如果远程分支是与当前分支合并,则冒号后面的部分可以省略git push <远程主机名> <本地分支名>:<远程分支名>
https://www.cnblogs.com/qianqiannian/p/6008140.htmlgit log [--pretty=oneline]
git log --oneline -3
git log -p // 查看具体文件提交历史
git reflog 可以查看所有分支的所有操作记录(包括已经被删除的 commit 记录和 reset 的操作)
git cherry-pick commitid
-d:--delete:删除
-D:--delete --force的快捷键
-f:--force:强制
-m:--move:移动或重命名
-M:--move --force的快捷键
-r:--remote:远程
-a:--all:所有
-u: --update: 只会标记本地有改动(包括删除和修改)的已经追踪的文件
git checkout -b 本地分支名x origin/远程分支名x
git fetch origin 远程分支名x:本地分支名x
作用:这样使用git pull或者git push时就不必每次都要指定从远程的哪个分支拉取合并和推送到远程的哪个分支了
建立联系:git branch -u origin/分支名
或git branch --set-upstream-to origin/分支名
撤销本地分支与远程分支的映射关系:git branch --unset-upstream
git push my master-bug-ZSTAC-23254
git checkout master
git pull origin master
当你在 master 分支上开了一个新分支并且已经解决完问题后,可以将 master 和 hotfix 进行合并,使用 $ git checkout master, $ git merge hotfix 进行合并。
$ git checkout master $ git merge workBranch 。合并完成后,可以将工作分支删除。$ git branch -d workBranch,需要注意的是,当我们删除的分支还包含未提交的内容,分支删除会失效。强制删除可以使用 -D
一个算法的时间复杂度反映了程序运行从开始到结束所需要的时间。把算法中基本操作重复执行的次数(频度)作为算法的时间复杂度。
没有循环语句,记作O(1),也称为常数阶。只有一重循环,则算法的基本操作的执行频度与问题规模n呈线性增大关系,记作O(n),也叫线性阶。
常见的时间复杂度有:
一个程序的空间复杂度是指运行完一个程序所需内存的大小。利用程序的空间复杂度,可以对程序的运行所需要的内存多少有个预先估计。
一个程序执行时除了需要存储空间和存储本身所使用的指令、常数、变量和输入数据外,还需要一些对数据进行操作的工作单元和存储一些为现实计算所需信息的辅助空间。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.