3

I want to revert to the state before my last git pull --rebase request. I dont remember the last commit Id to which I can reset. This change I want to do locally , Any suggestions how to do it. I got the following using git reflog, dont know how to proceed.

 >git reflog 
 3b52052 HEAD@{0}: rebase finished: returning to refs/heads/master
3b52052 HEAD@{1}: pull --rebase: checkout 3b520529dd08834067f316658bc450af1d6c5313
44e2c32 HEAD@{2}: clone: from https://xyy@bitbucket.org/abc-api/xyz.git
unicorn2
  • 844
  • 13
  • 30
prit kalra
  • 319
  • 4
  • 18
  • One option is find the `` of the commit and then do `git reset --HARD HEAD~n`, where `n` is the number of steps to get back to the commit you want. – Tim Biegeleisen Jan 12 '16 at 09:17
  • Pretty sure that first column is the commit ID, isn't it? So, you'd just want to reset to `44e2c32`, or did I misunderstand the question? – DaveyDaveDave Jan 12 '16 at 09:18
  • Possible duplicate of [Undoing a git pull --rebase](http://stackoverflow.com/questions/2213235/undoing-a-git-pull-rebase) – Chris Maes Jan 12 '16 at 10:33

1 Answers1

4

If the rebase only just happened, you can do:

git reset --hard ORIG_HEAD

ORIG_HEAD stores the reference to the previous commit, prior to an operation such as a merge or rebase. Some more detail on ORIG_HEAD can be found here.

Community
  • 1
  • 1
bcmcfc
  • 25,966
  • 29
  • 109
  • 181