Frage

I'm trying to do a git merge master from another branch, then I got this conflict:

<<<<<<< HEAD
=======
    t.text     "label_en"
    t.text     "help_text_en"
    t.text     "options_en"
>>>>>>> master

I know how to resolve the conflict, but I'm curious why does git recognize this as a conflict in the first place since the HEAD version has no content on the specific line.

<<<<<<< HEAD
=======

Isn't a simple case for git to just add the 3 lines from the master and merge it?


Update:

@Marcin is correct. Based on the answer, I did a test, let's say I have a git tree like below:

 A ---- B  (master)
      \
        C  (another branch)

content of temp.txt in commit A:

    t.text    "LALALA"

content of temp.txt in commit B:

    t.text    "label_en"
    t.text    "help_text_en"
    t.text    "options_en"

content of temp.txt in commit C is empty.


At this point, if I do:

git checkout another_branch
git merge master

Then I will get the following:

<<<<<<< HEAD
=======
    t.text     "label_en"
    t.text     "help_text_en"
    t.text     "options_en"
>>>>>>> master
War es hilfreich?

Lösung

You made a change on that line on master and another branch, something was removed from that line on the latter and git isn't able to resolve that conflict automagically.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top