From: Linus Torvalds Date: Tue, 11 Oct 2005 15:59:05 GMT Subject: Re: How to restore the original head after `git-reset --hard master^` Message-ID: In-Reply-To: <434BD65A.9000108@ust.hk> On Tue, 11 Oct 2005, Ben Lau wrote: > > After involves the command `git-reset --hard master^` in a repository, > the working tree , current head and index are restored to the parent of > master. That includes the content of '.git/refs/head/master'. Although > the original commit object is still existed , I couldn't find it back. > > Is there anyway to recover the original master branch ? Just run "git-fsck-objects" and look at any dangling commits. The commit and related objects are still there (unless you've run "git prune"), so once you find the name of it, you're all done. First check that you have the right one by doing git log and if that looks right, you can just do git reset --hard and you should be back in business. Linus