Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undoing a git pull --rebase

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?

like image 760
Thomas Avatar asked Feb 06 '10 13:02

Thomas


People also ask

Can I undo a git pull rebase?

1 Answer. You can use the reflog to search out the first action before the rebase started then reset --hard back to that. e.g.

How do I undo a git pull?

There is no command to explicitly undo the git pull command. The alternative is to use git reset, which reverts a repository back to a previous commit. We're working on a project called ck-git. A collaborator has just pushed a commit to the remote version of the project that is stored on GitHub.


1 Answers

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 
like image 124
Pat Notz Avatar answered Oct 12 '22 13:10

Pat Notz