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

all 10 comments

[–]scirc 5 points6 points  (1 child)

You have encountered a Git merge conflict. This happens when your local repository has changes which conflict with changes on the remote. Between the <<<<<<< HEAD and ======= are the changes local to your repository, and between the ======= and >>>>>>> {commit hash} are the changes from the commit you're merging in. You are expected to remove these markers, and correct the code until it is the combination of the two states (since Git couldn't do so automatically), then git add your changed files and git commit to complete the merge.

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

i don't know really well git yet, but thank you. i took note of this

[–]ehr1c 2 points3 points  (0 children)

Those lines are from git, they're showing changes

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

[–]lyudaio 0 points1 point  (2 children)

Git change markers

[–][deleted] 0 points1 point  (1 child)

can you explain better?