Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can there be conflicts in a git interactive rebase when I haven't made any changes?

Tags:

git

I wanted to reword a commit in git so I did a git rebase -i 00112233 or something similar and I get merge conflicts without making any changes to the commits that will be applied. I enter the merge command, the editor pops up, I accept what's there and there's a merge conflict.

My understanding of git rebase -i is that HEAD is set to 00112233 and then the commits after 00112233 (which are already consistent since they've been applied to get to the current state) are applied in the order specified in the editor (which I haven't changed in this case). I can't figure out how that process would lead to a merge conflict.

What are any ways such a situation can occur?

like image 927
mrmcgreg Avatar asked Feb 07 '14 01:02

mrmcgreg


1 Answers

If the history in question is not linear, you may have to reapply the conflict resolution you employed when you first merged. To iilustrate, if history is:

C:\Temp\TestRepo>git log --graph  --oneline
*   3fc0537 Merge branch 'branch'
|\
| * 79e29f9 branch
* | 0de3658 master
|/
* edead94 Initial revision

And the merge commit 3fc0537 contained a conflict:

C:\Temp\TestRepo>git log -1
commit 3fc053701a53a30a01469f560ad5057eab74d126
Merge: 0de3658 79e29f9
Author: Edward Thomson <[email protected]>
Date:   Thu Feb 6 17:55:59 2014 -0800

    Merge branch 'branch'

    Conflicts:
        file.txt

Then rebasing off edead94 will produce a merge conflict.

like image 104
Edward Thomson Avatar answered Oct 08 '22 18:10

Edward Thomson