mergetool

Published Dec 27, 2023
Contribute to Docs

In Git, a merge conflict is a situation that commonly occurs when merging a branch into a codebase. The mergetool command is often used to resolve this these conflicts.

Syntax

git mergetool

Example

Below is an example on how to use git mergetool. The developer runs the command and the merge conflict appears:

git mergetool
# Conflicting section:
<<<<<<< HEAD
## Creating a Tutorial
We highly recommend using Markdown to create your tutorial for our audio editor.
=======
If you need help, check out our templates.
>>>>>>> UPDATING-THE-DOCS
  • <<<<<<< HEAD: where the developer’s changes appear.
  • ====: Divides the developer’s changes from the changes in the other branch, followed by >>>>>>> UPDATING-THE-STYLE-GUIDE

To complete this command, the developer removes the conflict markers <<<<<<<, =======, >>>>>>>, and pushes the changes to the updating-the-style-guide branch with the following commit message:

git commit -m "docs: update information about tutorials"

Other tools

Here are a list of other tools that are used to solve merge conflicts:

  • Kaleidoscope: Developers often use this to resolve merge conflicts due to its use of different highlighted colors and powerful features ranging from a Convert to Merge command, text filters that remove unimportant data, and a debugger.
  • Visual Studio Code: This Integrated Development Environment (IDE) has a built-in 3-way merge editor, which displays the incoming changes to the file and provides a button that enables the changes to be accepted into the file. This allows developers to edit files and resolve conflicts easily.
  • Sublime Merge: Tool comes in a paid and free version. It is deemed to have a great user interface and is intuitively easy to use.

All contributors

Contribute to Docs

Learn Git on Codecademy