使用git,在冲突期间如何做'使用他们'? [英] Using git, how to do a 'use theirs' during a conflict?

查看:378
本文介绍了使用git,在冲突期间如何做'使用他们'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用git,我该如何做一个使用他们的类型分支合并命令?此命令应该用原始版本覆盖本地版本。

  $ git checkout master 
$ git分支-M master master-master
$ git checkout --track -b master origin / master

git-merge 联机帮助页将'我们的'战略定义为(强调增加)
$ b


合并战略
我们

这可以解析任意数量的头,但合并
的结果始终是当前分支头。用于
取代旧分支的旧开发历史。


如果您想要远程分支获胜,请创建一个跟踪分支,检查出来,并从那里 git merge -s our ...


With git, how do I do a "use theirs" type branch merge command? This command should just overwrite my local version with the origin's version.

解决方案

To replace your master with origin's master:

$ git checkout master
$ git branch -M master old-master
$ git checkout --track -b master origin/master

The git-merge manpage defines the 'ours' strategy as (emphasis added)

MERGE STRATEGIES

ours
This resolves any number of heads, but the result of the merge is always the current branch head. It is meant to be used to supersede old development history of side branches.

If you want a remote branch to win, create a tracking branch, check it out, and git merge -s ours ... from there.

这篇关于使用git,在冲突期间如何做'使用他们'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆