I had a quick look at the 1rst one, this anwser is the good one to me:

The easiest way would be to find the head commit of the branch as it was immediately before the rebase started in the reflog...

git reflog
and to reset the current branch to it (with the usual caveats about being absolutely sure before reseting with the --hard option).

# Suppose the old commit was HEAD@{5} in the ref log
git reset --hard HEAD@{5}
You can check the history of the candidate old head by just doing a git log HEAD@{5} .

If you've enabled per branch reflogs you should be able to simply do git reflog branchname@{1} as a rebase detaches the branch head before reattaching to the final head. I would double check this, though as I haven't verified this recently. You can do this by adding:

[user]
   logallrefupdates=true


Did I miss somethig ?

Thanks,
-Fred

-----Message d'origine----- From: Justin Mclean
Sent: Thursday, March 21, 2013 10:49 AM
To: dev@flex.apache.org
Subject: Re: [OT] Log history

Hi,

True, the git rebase hasn't got a dry run but you can undo it if it didn't please you:

git reflog

Seems it doesn't always work - which makes me a little nervous:
http://stackoverflow.com/questions/134882/undoing-a-git-rebase

Sometime you need to do this (a bit scary):
http://www.bluemangolearning.com/blog/2009/03/recovering-from-a-disastrous-git-rebase-mistake/

Justin

Reply via email to