Undoing a pull in Git

Asked

Viewed 13,715 times

5

I have a project and at the moment I have 3 branches, the master, one dev and one that I needed to create in parallel to the dev for a funcionalidade the part, so far no news, my problem was that I’m in the branch and made a git pull origin funcionalidade and with it downloaded everything from the functionality to the dev doing the merge, and I wasn’t supposed to do that, there’s no way to undo that pull?

1 answer

16


Tried to reset? Try:

git reset --hard

If you need to reset to a specific state just say what it is:

git reset --hard hash_do_commit_aqui

This should also work in some situations:

git merge --abort

Or else:

git reset --merge
  • 1

    Simple solutions to simple problems! The git reset --hard it just didn’t work, because for the functionality I had already made some commits, so I just looked for the point, I found the specific hash and with that it did work.

  • 2

    A simple tactic I sometimes use is git reset --hard HEAD~N, where N is the number of commits back that I want to go back to.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.