Have you ever sworn that you commited feature X, but now can’t find it? git log shows nothing?
It’s possible that you committed them while you had a detached head.
git status # Not currently on any branch.
Oops. And it turns out that not even “git log –all”, you know, shows you all:
–all: Pretend as if all the refs in $GIT_DIR/refs/ are listed on the command line as <commit>.
More like “git log —most“.
If you’re hopelessly trying to figure out where in the world you were, the best way is probably to:
git log -g -9 HEAD
Which will list the last several HEADs you’ve been on. At this point you can re-capitate yourself with:
git checkout master && git merge DETACHED_HEAD_SHA
Comments
Comments are closed.