Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: Recovering from an aborted git-rebase?

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:42:48

Steven Grimm [off-list ref] 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help