为什么git pull更改我的代码而没有引发所有更改的合并冲突? [英] Why did git pull change my code without throwing merge conflicts for all changes?

查看:93
本文介绍了为什么git pull更改我的代码而没有引发所有更改的合并冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地提交了一项新功能,从远程撤出并出现了合并冲突.解决它们后,我的功能停止工作.我以为我出错了,问

I commited a new feature locally, pulled from remote and got merge conflicts. After resolving them, my feature stopped working. I assumed that I made an error and asked a question about this yesterday. So I did a hard reset to my previous commit, repeated the merge and resolved the conflicts I was shown.

但是,我的功能再次停止工作.我手动浏览了一下代码,发现本地提交的部分代码已通过拉取进行了更改,但此部分未显示任何合并冲突.

But again, my feature stopped working. I looked through the code manually and saw that part of the code of my local commit was changed by the pull but no merge conflict had been displayed for this part.

因此,对于某些更改,将显示合并冲突,但对于其他更改则不显示.我通过第三次重现这种情况证实了这一点.

So for some changes, merge conflicts were displayed but not for others. I confirmed this by reproducing the situation a third time.

这种行为可能是什么原因?

What could be the cause of this behaviour?

推荐答案

这与并发修改有关:如果您的分支和远程修改的文件中有同一行,则您是退出,您会遇到冲突.

This is about concurrent modification: if you have the same line in a file modified both by your branch and the remote one you are pulling from, you will get a conflict.

但是,如果其他人将坏"邮件推向了远端,拉出后立即应用的代码(没有冲突,因为您没有直接修改该部分),那么您将必须测试该拉出的结果才能检测到它.

But if someone else has pushed to remote a "bad" code which, when pulled, get applied right away (no conflict, because you did not modify directly that part), then you will have to test the result of that pull to detect it.

这篇关于为什么git pull更改我的代码而没有引发所有更改的合并冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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