Why do I get a conflict with `git rebase -p`

北战南征 提交于 2021-02-08 07:35:22

问题


I'm trying to understand how git rebase handles merges. I thought that with -p, it would be able to rebase conflicting merge that would have already been resolved. But it seams like it doesn't.

Here is an example to illustrate the issue:

git init
touch a && git add . && git commit -m 'first commit'
git branch b
git branch c
echo 'a' >> a && git add . && git commit -m a

git checkout b
echo 'b' >> a && git add . && git commit -m b

git checkout master
git merge b
echo ab > a
git add .
git commit

git checkout c
touch c && git add . && git commit -m c

git checkout master
git rebase -p c

Here I get a conflict applying the merge commit. Can someone explain to me why ?


回答1:


No, -p just keeps the merge commits in the history instead of flattening them. The docs explicitly say that this doesn't help with manual merging:

(from the man page)

Merge conflict resolutions or manual amendments to merge commits are not preserved.



来源:https://stackoverflow.com/questions/35714267/why-do-i-get-a-conflict-with-git-rebase-p

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!