Why did git pull change my code without throwing merge conflicts for all changes?

亡梦爱人 提交于 2021-01-25 07:07:54

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/65391983/why-did-git-pull-change-my-code-without-throwing-merge-conflicts-for-all-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!