git rebase
master分支

feature分支

冲突解决
- VCS->git->resolve conflicts->merge->…
- git rebase –continue
- 提示Successfully rebased and updated refs/heads/feature/1.
在feature分支上 执行 git rebase master ,会出现冲突,若冲突的解决是采用master分支的,
1.冲突解决改为与master一样的,则feature的提交就不用了,丢弃,rabase后的结果跟master一样.
feature分支变为

2.冲突解决改为与之前都不一样的,并会要求提交新的commnet ,则feature分支除了有自己本次的commit ,还有master分支领先的commit, 本例中只有master 6。
feature分支变为

git merge解决冲突
开始feature/1 pull request feature/2 有冲突.
feature/1

feature/2

1.merge 改为 接受feature/1
此时还处于mergeing过程中,需要输入git commit -m “合并commit的评论” 结束merge.
feature/1变为:增加了master4 和 merge commit, merge commit 没有文件修改。

feature/2 合并后 变为:

2.接受feature/2的
此时合并到feature/2 ,远端不会显示2.txt有修改 , 只会显示feature/1的其他变更, 虽然feature5 commit 在master 4时间上更近,或者说更新。
3.都不接受,新的更改。则merge commit 会有修改。
解决冲突后 都需要commit
git merge 解决冲突 不会改变原来的commit.
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!