在一个混帐合并,你如何替换你的版本与版本git说有冲突? [英] In a git merge, how do you just replace your version with the version git says there is a conflict with?

查看:129
本文介绍了在一个混帐合并,你如何替换你的版本与版本git说有冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个文件:A和B.如果我一直在处理A并且一个合作伙伴正在处理B,我想合并文件A和B. B已经提交。假设我的合作伙伴已经完成了我正在进行的更改,所以我只想用他们的B文件替换我的A文件 - 不需要合并。如何解决与git的冲突?



谢谢!

解决方案

假设您和您的合作伙伴修改了相同的文件,并且已经提交给各个仓库。

合并伙伴更改
#合并失败,冲突
git checkout origin FILE_TO_REPLACE#用伙伴取代更改ver
git commit#完成合并


I have two files: A and B. If I have been working on A and a partner is working on B, I want to merge files A and B. B is already committed. Let's say my partner already made the changes I was working on, so I just want to replace my A file with their B file - no merge needed. How do I resolve the conflict with git?

Thanks!

解决方案

Let's say both you and your partner modified the same file, and is committed to each respective repository.

git pull                             # fetch/merge partners changes
# merge fails, conflict
git checkout origin FILE_TO_REPLACE  # replace changes with partners ver
git commit                           # finish merge

这篇关于在一个混帐合并,你如何替换你的版本与版本git说有冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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