Merge conflict in a file that wasn't modified

2019-06-26 00:12发布

问题:

When I try to rebase branch featureX on master, I get a conflict in a file (let's call it moduleA/foo) that was not modified in either master or featureX since they diverged! I checked that with the following log command:

git log master...featureX -- moduleA/foo

and the result was empty (no commit on either branch touched the file since the branches diverged).

How is this at all possible and what can I do to avoid such misleading conflicts?

回答1:

As @Xlee said, rebase can result on changing the hash of the commit and messing up with history.

There are some other possibilities such as :
- featureX have been force pushed
- Someone created a commit which changes the moduleA/foo file and reverted it on master
- you GIT is playfull and likes to tease you. Your choice