Re: How to restore the original head after `git-reset --hard master^`
- From
Daniel Barkalow <barkalow@iabervon.org>
- Date
- Oct 11, 2005, 16:58 UTC
- Message-ID
- <Pine.LNX.4.63.0510111240410.23242@iabervon.org>
- In-Reply-To
- <Pine.LNX.4.64.0510110856520.14597@g5.osdl.org>
On Tue, 11 Oct 2005, Linus Torvalds wrote:
Show 12 quoted lines
> 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.
That reminds me: if you lose all of your refs, it's hard to get them back, because git-fsck-objects aborts if you don't specify any heads or have any refs. Is there some reason for this check?
-Daniel *This .sig left intentionally blank*