I work in a small company and our Git repo is a little messed up. I just did a git pull
and my changes made earlier today are gone!
When I work on HEAD on the master branch, git log
shows my last commit b94940c63ef965ce45b0d64ccfba4359134d2552 in its history.
Now if I do git log filename
for the problematic file that lost my changes, that commit is not shown (only shows an earlier commit).
Performing git log --follow filename
, my commit b94940c63ef965ce45b0d64ccfba4359134d2552 is shown as most recent.
And sure enough if I do:
git checkout b94940c63ef965ce45b0d64ccfba4359134d2552
git log filename
then the commit is shown and my changes are in the file!
In other words, the commit I made is shown in the branch history (blocking a branch merge), but individual modified files do not have that commit in their history! (unless I explicitly checkout that commit).
Questions:
How on earth did this happen?
How do I fix it? (We have problems with multiple files in our repo)