Let’s say you decide you’d like to merge the changes from
Here’s where the trouble begins!
You’ve made commits on separate branches that alter the same line in conflicting ways. Now, when you try to merge
master, Git will not know which version of the file to keep.
Switch to the
From the terminal, enter the command below:
git merge fencing
This will try to merge
In the output, notice the lines:
CONFLICT (content): Merge conflict in resumé.txt Automatic merge failed; fix conflicts and then commit the result.
We must fix the merge conflict.
In the code editor, look at resume.txt. Git uses markings to indicate the
HEAD (master) version of the file and the
fencing version of the file, like this:
<<<<<<< HEAD master version of line ======= fencing version of line >>>>>>> fencing
Note: If the markings are not showing in
resume.txt, please close
resume.txt and re-open via the folder icon at the top left corner of the editor.
Git asks us which version of the file to keep: the version on
master or the version on
fencing. You decide you want the
From the code editor:
Delete the content of the line as it appears in the
Delete all of Git’s special markings including the words
fencing. If any of Git’s markings remain, for example,
=======, the conflict remains.
Add resume.txt to the staging area.
Now, make a commit. For your commit message, type “Resolve merge conflict” to indicate the purpose of the commit.
Here’s a hint for the commit command.