Back
I would like to undo my git pull on account of unwanted commits on the remote origin, but I don't know which revision I have to reset back to.
How can I just go back to the state before I did the git pull on the remote origin?
To undo a git-pull you could use:
git reset --keep HEAD@{1}
This command will undo the pull command and return back to the previous state.
In the older version of git the command is something like:
git reset --hard HEAD@{1}
This command can erase all the local changes. You need to be more careful using -- hard option.
Refer: https://git-scm.com/docs/git-reset#Documentation/git-reset.txt---keep
31k questions
32.8k answers
501 comments
693 users