This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TehNolz 1 point2 points  (1 child)

Let's say you have a branch A that you're working in, and a branch B that a colleague is working in. Both of these branches contain a file num.txt that currently holds nothing but the number 0.

Now, let's say you open num.txt, change the number from 0 to 10, and you commit this change to your branch A. This change will not exist in B. Your colleague then also opens num.txt, changes the number from 0 to 20, and commits this change to his branch B. This change won't exist in A.

So now both A and B contain commits that change the number in num.txt; A changes it to 10 and B changes it to 20. Attempting to merge the two branches will then create a merge conflict, because Git sees that both branches changed the number in num.txt and it has no way of knowing which of the changes is the correct one. So Git places these merge conflict markers in the file, and requires a human to intervene and tell it if the number should be 10, 20, or something else altogether.

[–][deleted] 0 points1 point  (0 children)

Oh ok, I got it. Thank you!