Created by Dan MouldingLinked to 50.3m issues across 291 teams
Step 1 - Save your current work
If you want to save your current branch's state before resetting it, you can do the following:
git commit -a -m "Saving my work, just in case" git branch my-saved-work
Step 2 - Reset your local repository branch
git fetch origin git reset --hard origin/master
Note - the commands above assume that the remote repository is named "origin" and that the branch named "master" in the remote repository matches the currently checked-out branch in your local repository.
Note - avoid pushing into a non-bare repository. If you recently pushed into your local repository, you should be aware that it is not recommended to push into a non-bare repository (and not into the currently checked-out branch, in particular).