I have a branch which I’ve merged into master.
On the branch, git log file shows a commit on February 9
On master, git log file does not show the commit on February 9th
On master, git log does show the February 9th commit
The file does not reflect the changes made on February 9th, yet git log shows the commit. It appears git merged in the commit, but didn’t actually apply it to the file. What could be causing this?
Edit: I think I figured out what happened and answered below. I cleaned up the original question for clarity. I had originally written I thought this to be a bug with git, but I don’t think that’s the case anymore. It would be nice, however, if git log file did show these commits to the file. Thanks to everyone who helped, especially Borealid.
Earlier Edit: I genuinely believe this is a bug with git. This file was never renamed, yet git believes that it was, and that is why the commit isn’t being applied. I created another branch, performed the merge, and this problem didn’t occur. I can reproduce the bug on the branches where this occurred. I would be happy to help any git developer debug the problem with me, but I can’t send you my repository.
Quoted from Dave:
The reson that
git log -- fileonly show commit #1 and #3 is because how git-log (default mode) walks the commit chain; when a merge commit is found and there exists a parent commit such that the selected file has the same content after the merge as in the parent commit, git-log will follow (one) such parent and reject all other parents.In this case, since the merge conflict is resolved by only keeping changes made in master (the file will have the same content in commit #1 and commit #4) git-log will only walk the master branch.
In more details: http://schacon.github.com/git/git-log.html (section “History Simplification”)