0 votes
1 view
in DevOps and Agile by (30k points)
edited by

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?

1 Answer

0 votes
by (51.2k points)

To undo a git-pull you could use: 

git reset --keep [email protected]{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 [email protected]{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

Welcome to Intellipaat Community. Get your technical queries answered by top developers !