When you’re in the step of undoing a commit, the git reset --soft ^HEAD command, will reset your working tree to your previous tree state. This means that you will loose all the files involved in the last commit.

If you have executed the command, you may be surprised at first glance, that your files disapeared from your directory. But the truth is that they are not, from the git point of view. You still can rebirth their references hash, thus their content.

# sh
git fsck --lost-found

This will creates references to your dandling commits in the ./git/lost-found directory (http://man.github.com/git/git-lost-found.html)

Now to recover your files from the reseted commit, just check it using the provided hash git show ID, then use the

# sh
git rebase ID

Created on 13-05-2010 by Eric le bihen

comments powered by Disqus