質問

On one of my repositories the local master is ahead of the remotes/origin/master

* - master (123)
* -
* - remotes/origin/master (456)

All my other local repos (based on the same remote repository) have the remote/origin/master at the same commit hash (123). How do I reset the local repo so the remotes/origin/master is back in sync?

役に立ちましたか?

解決

what happens if you do git fetch origin?

or if you have manually broken something with the remote branch you could always:

git remote -v # note url
git remote rm origin  
git remote add origin <url>

他のヒント

As Pierre pointed out you will "lose" your local modifications (if you have commited your changes they are still there as loose objects). So you might want to create a temporary branch before resetting

This will reset your local branch so it points to the same commit as the remote.

git fetch origin
git checkout -b old_master // optional 
git reset --hard origin/master
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top