Search code examples
gitgithubgit-merge-conflict

How can I fix a merge conflict from the Github website?


I was on a branch called make-monolith-ids-constant.

I ran these commands in the terminal.

git checkout make-monolith-ids-constant
git fetch origin master
git rebase origin/master

I now have a merge conflict I'm trying to resolve on the website and this is all that shows up.

<<<<<<< make-monolith-ids-constant
                            @link-click="setAddPreviewText"
=======
>>>>>>> master

If I would like to keep only the changes from the master branch what would I delete here?


Solution

  • What you are seeing are Git's merge conflict markers, which have been inserted into the source file, pending resolution. The following code given reads as:

    <<<<<<< make-monolith-ids-constant
                                @link-click="setAddPreviewText"
    =======
    >>>>>>> master
    

    In the parent branch make-monolith-ids-constant, there is the following code:

    @link-click="setAddPreviewText"
    

    In the master branch, this does not appear. So, you need to decide whether or not you want to keep this line. In your local make-monolith-ids-constant branch, delete the <<<<<<<, =======, and >>>>>>> markers, leaving behind either that line, or not line at all.

    Then, git add this source file, commit, and then push your make-monolith-ids-constant branch back to GitHub:

    git push origin make-monolith-ids-constant