-1

I ran a git pull command on my master branch, which broke the web app. I want to return to the previous state, but I couldn't find a way to undo the last pull. Help!

Sohail
  • 11
  • 3

2 Answers2

1

If you haven't done anything else - try

git checkout HEAD@{1}

or if you want to reset the branch

git reset --hard HEAD@{1}

To get more insight into where you're going to move do

git reflog

and review HEAD@{n} references to find the one you need.

https://git-scm.com/docs/git-reflog

0
  1. git pull origin master ← oops this caused an error/unwanted result
  2. git reflog ← find the commit sha of the previous command. See More
  3. git reset --hard <sha from 2.>
lbragile
  • 7,549
  • 3
  • 27
  • 64