Git:合并但覆盖更改 [英] Git: Merging but overwriting changes

查看:91
本文介绍了Git:合并但覆盖更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将git中的一个分支合并到master时,我经常会遇到合并冲突。有没有办法合并一个分支,只是覆盖当前分支的东西?

解决方案

添加 -X我们的参数指向您的 git merge 命令。



假设您正在你当地的分支。然后你想合并 master 中的内容:

  git合并-X我们的主人

另一方面,如果 master 并希望将本地分支合并到 master 中,然后@elhadi正确地说您应该使用> :

  git merge -X他们的一些分支


When I merge a branch in git to master I often get merge conflicts. Is there a way to merge a branch and just overwrite the stuff in the current branch?

解决方案

Add -X ours argument to your git merge command.

Say you are working in your local branch. Then you want to merge in what went in the master:

git merge -X ours master

On the other hand if you are in master and want to merge your local branch into master then @elhadi rightly says you should use theirs:

git merge -X theirs somebranch

这篇关于Git:合并但覆盖更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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