问题
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