2

How I could in git discard all local changes/commits and go back to the last pulled version (command has to be in one String(field))?

Igor K
  • 67
  • 1
  • 5

1 Answers1

1

You can reset your branch to the revision on in the remote repo:

git fetch
git reset --hard <remote-name>/<branch-name>

Example:

git reset --hard origin/master

Or find the commit SHA-1 of the "pulled version" and do:

git reset --hard <commit SHA-1>

To safe your (committed) work before you go back:

git checkout -b my-work

Note: Think twice before using git reset --hard, you will lose all your uncommitted changes!

sergej
  • 17,147
  • 6
  • 52
  • 89