问题
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