When doing a git pull, the pull failed in the middle, how do I reset everything?

Best Answer

Many times a 'git pull' command will fail for permissions reasons or other issues. In order to quickly set your git environment back to the master, use this command in Terminal:

sudo git reset --hard origin/master

Enter your password, and your files will be set to match the master branch. You can enter 'git status' to verify. This will wipe out any changed files in your git directory, so if there is anything you need to save, make a copy somewhere outside of your git directory, and copy back after the git reset.

Category
Hashtags
Updated: Nov 18 2017