Re: Recovering from an aborted git-rebase?
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Jan 9, 2007, 23:29 UTC
- Message-ID
- <20070109232949.GB30023@spearce.org>
- In-Reply-To
- <45A42341.8040304@midwinter.com>
Steven Grimm <koreth@midwinter.com> wrote:
> Got this from one of the other people here who's using git. Luckily he > was able to restore his repo from a filesystem snapshot, so no permanent > harm done, but what's the pure-git way to recover from this? Are the > revisions in question really gone?
Try `git lost-found` before you use `git prune` (or also now `git gc`).
Also, if you have relogs enabled on your work branches (and I hope you do, as its now the default) you can look at the branch from earlier, e.g.:
git log HEAD@{5.minutes.ago}
or
git log HEAD@{1}to look at HEAD was just before `git rebase` did the reset. Which would be the commit you lost, but want back.
Unfortunately we don't really have a reflog viewing utility yet so
you just have to sort of guess around with the @{...} syntax to find
what you are looking for. But if you can locate the correct SHA1
for the last commit you want back you can do a `git reset --hard $sha1`
to restore your working branch, then do the rebase the way you meant to.
-- Shawn.