Undoing a git pull --rebase

Thomas picture Thomas · Feb 6, 2010 · Viewed 36.3k times · Source

Hey I'm new to git and I need to undo a pull, can anyone help?!? So what I've done is...

  1. git commit
  2. git stash
  3. git pull --rebase
  4. git stash pop

this created a bunch of conflicts and went a bit wrong. Now doing 'git stash list' reveals that my stash is still there. Is it possible to revert my repo back to the point just after doing git commit. So effectively my repo only contains only changes I have made and nothing new from the server?

Answer

Pat Notz picture Pat Notz · Feb 8, 2010

Actually, to make this easier Git keeps a reference named ORIG_HEAD that points where you were before the rebase. So, it's as easy as:

git reset --hard ORIG_HEAD