mergetool
- Git course
- Intermediate
- Lesson 15/82
- 4 min
Learn to resolve conflicts visually with git mergetool.
What Is git mergetool?
git mergetool helps you resolve merge conflicts using a visual tool. You can inspect the contents side by side and decide which changes to keep.
git mergetoolA visual tool makes it easier to compare conflicting contents. The tool may need to be configured on your system.
Visual Comparison Tools
Visual merge tools can display the current branch's content, the incoming branch's content, and the merge result in separate sections. This lets you compare changes line by line and choose the appropriate result.
git mergetoolGit opens the configured tool if one is available. Applications such as Meld help you inspect different file contents side by side.
Practice Prepare the Visual Tool Command
Assign git mergetool to a JavaScript variable named toolCommand. Then print the command.
Starter code
const toolCommand = "";
// Komutu yazdırSample solution
const toolCommand = "git mergetool";
console.log(toolCommand);Expected output
git mergetool
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What is the main purpose of using git mergetool?
- Delete all commits in the repository
- Inspect and resolve conflicts visually Correct answer
- Create a new user account
- Automatically delete all branches
Explanation: git mergetool makes it easier to resolve conflicts by comparing conflicting file contents in a visual interface.
2 Identify the Visual Comparison Tool
git ____ app.js
git mergetool app.js
Explanation: git mergetool helps resolve merge conflicts using a visual tool. difftool is used for comparing file differences.
3 Visual Tool Concepts
| Term | Meaning |
|---|---|
git mergetool |
Opens the visual merge tool |
Visual |
Inspection through an interface |
Diff tool |
Compares changes |
Meld |
Visual comparison application |