git- git rebase

5.git rebase操作,

同时参考:

https://www.jianshu.com/p/6960811ac89c

http://www.ruanyifeng.com/blog/2015/08/git-use-process.html

1) 将master分支的提交同步到dev分支:

在dev分支下执行:git rebase master

若没有冲突:git  push -f   

若有冲突:会有conflict的提示,修改具体的冲突文件,修改完保存,然后 git add xxx(冲突文件名)  然后在进行git rebase --continue 操作,最后git push -f

2)合并 commit1 commit2 commit3 为一个commit

git log 找到commit1之前的一个commit id 为 xxx

git rebase -i xxx

会弹出如下提示,最下面的是最新的提交,把第2、3、4行的pick改为s

这样就合并到第一行的了,保存退出

然后会让你填写commit描述,如果不填就是默认的,保存退出即可

然后执行 git push -f 

猜你喜欢

转载自www.cnblogs.com/rrcj/p/11480170.html