Git pull in a remote branch and accept all incoming changes

Do a git pull that overwrites local conflicts and accepts all remote changes via:

git pull -s recursive -X theirs <remoterepo or other repo>

For example, overwrite your local master branch with the remote origin‘s master branch:

git pull -s recursive -X theirs origin master

If it’s just a single file you need to overwrite, use git checkout:

git checkout --theirs path/to/file

Leave a Reply

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