开发者

Merge local repository with Github repository discarding remote files

What I want t开发者_如何转开发o do:

  1. Pull from my remote repository on github.
  2. Preserve all the files in my local repository and discard the ones from github.
  3. 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:

  1. git pull origin master: to get the remote repository
  2. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜