Merge conflict resolution

后端 未结 5 1616
执笔经年
执笔经年 2021-01-31 07:35

When there\'s a merge conflict in Git, junk like the following is inserted into the conflicting files. Three questions:

  1. How do you read these annotations?
5条回答
  •  轮回少年
    2021-01-31 07:44

    When you have two branches with changes to the same file and you try to merge them, a merge conflict will occur. To see the list of conflicted files run git status on your terminal.

    Conflicted lines of the files will be marked with visual indicators: <<<<< - The conflict starts after this line. ===== - Devides changes from HEAD and merging_branch. >>>>> - End of the conflicted lines.

    <<<<<<< HEAD
    conflicted text from HEAD
    =======
    conflicted text from merging_branch
    >>>>>>> merging_branch
    

    When you fix your conflicted files and you are ready to merge, all you have to do is run git add and git commit to generate the merge commit. Once the commit was made ,git push the changes to the branch.

    Reference article: Git merge.

提交回复
热议问题