Reputation: 1023
Hey I'm new to git and I need to undo a pull, can anyone help?!? So what I've done is...
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?
Upvotes: 73
Views: 63149
Reputation: 1
I found this interesting video https://youtu.be/xN1-2p06Urc
The solution is just to do git rebase --abort
Upvotes: 0
Reputation: 91
You should checkout the command
git reset --merge
That eliminates the need for a git commit; git stash before a pull (Don't know about rebase though)
The command returns a workspace with uncommitted changes to the state before a conflicting pull.
Upvotes: 8
Reputation: 214426
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
Upvotes: 182
Reputation: 265817
using git reflog
you will see a list of commits HEAD pointed to in the past
using
git checkout -b after-commit HEAD@{1} # or the commit you want to recover
you create a new branch at that precise position and check it out
Upvotes: 54
Reputation: 26556
Use git log -g
and find the commit index you want to go back to, the just do git checkout
index
Upvotes: 0