What I want t开发者_如何转开发o do:
- Pull from my remote repository on github.
- Preserve all the files in my local repository and discard the ones from github.
- Push my "up to date" local repository into github.
So imagine you've made a lot of changes in your local repository and is now very different from your github repository.
I could do:
- git pull origin master: to get the remote repository
- git mergetool: to resolve all the conflicts one by one.
But is there any way to resolve all the conflicts automatically?
That is, tell git that you simply want to preserve the files version from your local repository and discard the ones from the remote repository.
You could pull with the ours merge strategy
git pull --strategy=ours origin master
From kernel.org
This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches.
精彩评论