You are the victim of an evil merger.
Here's how to play it
git init testrepo cd testrepo touch initial git add initial git commit -m 'initial commit' git checkout -b feature_branch echo "A" >> file git add file git commit -m 'file committed' git checkout master
Now do an interactive merge as if merge conflicts have occurred
git merge --no-commit --no-ff feature_branch
and move the file file (merge of evil).
testrepo (master|MERGING) git mv file someOtherFile git commit
Now you will see that the branch wizard contains a commit (in my case 9469682 ) in which the file file was entered
git branch --contains 9469682 feature_branch * master
But git log does not display it because it was moved
git log -- file (no output)
Using
git log --follow -- file
and the commit will appear again.
Also keep in mind that merging can do more evil. If the contents of file also changed a lot than รจven git log --follow will not detect it because of the renaming threshold.
In this case, use git log --follow --find-renames= to set the renaming threshold.
If you create a diff, detect and report renames for each commit. For the following rename files while going through the history, see --follow. If n is specified, this is the threshold value for the similarity index (i.e., the number of additions / exceptions compared to file size). For example, -M90% means that git should treat the delete / add pair as a rename if more than 90% of the file has not changed. An unsigned% number should be read as a fraction with a decimal point in front of it. Ie, -M5 becomes 0.5 and thus coincides with -M50%. Similarly, -M05 is the same as -M5%. To limit the detection to an exact rename, use -M100%. By default, the similarity index is 50%.
Renรฉ link
source share