Looks like a few days ago I created a branch called detached HEAD and have been committing to it. My normal process is to commit to master and then push that to origin. But I can’t push detached HEAD.
My next stop screwed me. I selected git checkout master – and my detached HEAD branch disappeared. Going back to my project all of my changes in the past few days have been wiped.
Is there anyway I can get those changes back?
If
checkout masterwas the last thing you did, then the reflog entryHEAD@{1}will contain your commits (otherwise usegit reflogorgit log -pto find them). Usegit merge HEAD@{1}to fast forward them into master.As noted in the comments, Git Ready has a great article on this.
git reflogandgit reflog --allwill give you the commit hashes of the mis-placed commits.Source: http://gitready.com/intermediate/2009/02/09/reflog-your-safety-net.html