Git pull failed

Somehow I got my local git messed up. When trying to pull the following error was thrown.

Error: unable to resolve reference refs/remotes/origin/master

In order to make the local branch match the remote branch I had to remove the local bad master ref.

rm .git/refs/remotes/origin/master

git fetch origin

git reset —hard origin/master

To save my local data before I could have done as follows.

git commit -a -m “backup”

git branch backup

Leave a Reply

Your email address will not be published. Required fields are marked *