I have a git project which is only local, and only has a master branch. Yesterday I made a number of commits. Today I made one commit. The commit look fine — it was a diff on existing files and some new files.
However, when I look at my master branch in gitx, it only shows today’s commit, and makes it look like I committed all files from scratch with this one commit.
Git log shows the same thing, but git reflog shows all my previous commits:
$ git log
commit bd7d6af7f916706c5df6d57bed883d2c2d81f60f
Author: Sam Fen
Date: Wed Jun 20 12:00:38 2012 -0400
Add Genotype class, update naming
$ git reflog
bd7d6af HEAD@{0}: checkout: moving from master to master
bd7d6af HEAD@{1}: commit: Add Genotype class, update naming
bf0d3dd HEAD@{2}: commit: Add start to genetics manipulation library
2335bf2 HEAD@{3}: commit: Convert to CoffeeScript
4c26713 HEAD@{4}: commit: Initial commit with basic structure, trivial Jasmine t
The reflog shows what seems to be a weird double commit with the same hash (bd7d6af) for the last one, but I think that’s just because after I saw the empty history in gitx, I went back to the command line and typed ‘git checkout master’ just to make sure I was on master (I was).
Any thoughts as to what might have happened, and how I can recover my history?
It looks like bd7d6af thinks it is an initial commit
You can try
git reset bf0d3dd; git add -A; git commitand see if you get a proper commit.