DEV Community

Cover image for Reference Guide: Merge conflicts

Posted on • Updated on

Reference Guide: Merge conflicts

Welcome back to the Reference Guide series.

Merging is the act of integrating code changes from another branch into a working branch. With 'Git', there are times when competing changes cannot be resolved without intervention. Conflicts can occur when someone edits a file and someone else deletes the same file, or, when changes are made to the same line of the same file.

Merge conflicts can be a bit intimidating at first but rest assured they won't be for long. After a little practice, you'll be a pro in no time.


Once changes have been pushed to the branch name it’s a good practice to follow a few more steps to resolve potential conflicts before making a pull request in GitHub.

  • git pull origin master
    • This command updates the local branch to match the master branch.

git pull

Open a code editor of choice to review changes or conflicts. Generally, current changes will be highlighted in one color and incoming changes will be highlighted in a different color. Accept the current or incoming changes. Once completed run the following commands:

  • git status
  • git add –A
  • git status
  • git commit –m “add comment description of changes made”
  • git status
  • git push origin <name of branch>

Up next: Pull Requests

For the completed Reference Guide Series:

Top comments (0)