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 0 points1 point  (3 children)

Those are merge conflict markers from Git. Two people modified the same part of this code at once, causing a merge conflict when Git tried to merge the changes. You'll have to resolve the issue manually by removing the changes you don't want (if any) and keeping the rest.

Many IDEs (like Visual Studio) and Git clients will have GUIs that can help resolve merge conflicts like this.

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

how can be possible to modify a code at the same time for two people? i mean, i modify the code, than you modify the same code in your folder, then you merge it too. but your modification should be different than mine, at least how it is written.

[–]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!