Reputation: 2698
I have a fork of zprezto at http://github.com/ohcibi/prezto
To reproduce my problem:
git clone http://github.com/ohcibi/prezto
cd prezto
git checkout ohcibi
(i have a branch with that name, no typo here!)git merge master
The commit log shows that there are only 3 commits in ohcibi
that are new since the last merge commit which is around april 26th. All 3 of the commits do not touch any of the files that conflict (except one file where the confict is to be expected).
But why is that merge conflicting on the other files and even .gitmodules
as well?
Note: I don't need help solving that merge conflict! I know how to do that and I deliberately did not add the git-merge-conflict-resolution-tag
to that question as it would be a wrong tag (so it is not missing, don't add it!). I want to know why those conflicts happen in the first place (given that the conflicting files are *not* changed in both branches, which is the usual reason for a merge conflict, that I am aware of).
Upvotes: 2
Views: 3499
Reputation: 4263
Git uses three points on the tree in order to merge, your branch's head, the head of the branch you're merging in, and the most recent common ancestor of the two. When in doubt you can run the merge-base
plumbing command to find out what commit git sees at the most recent common ancestor.
git merge-base <branch1> <branch2>
Running that command I find the mergebase to be 4f87376b5
It's been just shy of 5 months since you last merged master into your branch. When you merged, master was pointing to a commit made on 2017-04-24. (Which is now the merge-base for your current merge.)
There have been 123 commits made on the master branch since that time, the most recent being made on 2017-09-19. These 123 commits can conflict with the changes in any of the 137 commits on your branch that are unreachable from master.
Git isn't looking at the "number of commits" or when and where they happened. All it's looking at is the cumulative difference between each branch head and the merge base. You can run git diff 4f87376b5 ohcibi
and git diff 4f87376b5 origin/master
to see the scope of changes being integrated from each side of the merge.
Upvotes: 5