{
    "content": [
        {
            "type": "text",
            "text": "# git-mergetool (man)\n\n## NAME\n\ngit-mergetool - Run merge conflict resolution tools to resolve merge conflicts\n\n## SYNOPSIS\n\ngit mergetool [--tool=<tool>] [-y | --[no-]prompt] [<file>...]\n\n## DESCRIPTION\n\nUse git mergetool to run one of several merge utilities to resolve merge conflicts. It is\ntypically run after git merge.\n\n## TLDR\n\n> Run merge conflict resolution tools to resolve merge conflicts.\n\n- Launch the default merge tool to resolve conflicts:\n  `git mergetool`\n- List valid merge tools:\n  `git mergetool --tool-help`\n- Launch the merge tool identified by a name:\n  `git mergetool {{-t|--tool}} {{tool_name}}`\n- Don't prompt before each invocation of the merge tool:\n  `git mergetool {{-y|--no-prompt}}`\n- Explicitly use the GUI merge tool (see the `merge.guitool` configuration variable):\n  `git mergetool {{-g|--gui}}`\n- Explicitly use the regular merge tool (see the `merge.tool` configuration variable):\n  `git mergetool --no-gui`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (6 subsections)\n- **CONFIGURATION**\n- **TEMPORARY FILES**\n- **GIT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "git-mergetool",
        "section": "",
        "mode": "man",
        "summary": "git-mergetool - Run merge conflict resolution tools to resolve merge conflicts",
        "synopsis": "git mergetool [--tool=<tool>] [-y | --[no-]prompt] [<file>...]",
        "tldr_summary": "Run merge conflict resolution tools to resolve merge conflicts.",
        "tldr_examples": [
            {
                "description": "Launch the default merge tool to resolve conflicts",
                "command": "git mergetool"
            },
            {
                "description": "List valid merge tools",
                "command": "git mergetool --tool-help"
            },
            {
                "description": "Launch the merge tool identified by a name",
                "command": "git mergetool {{-t|--tool}} {{tool_name}}"
            },
            {
                "description": "Don't prompt before each invocation of the merge tool",
                "command": "git mergetool {{-y|--no-prompt}}"
            },
            {
                "description": "Explicitly use the GUI merge tool (see the `merge.guitool` configuration variable)",
                "command": "git mergetool {{-g|--gui}}"
            },
            {
                "description": "Explicitly use the regular merge tool (see the `merge.tool` configuration variable)",
                "command": "git mergetool --no-gui"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "",
                "long": "--tool-help",
                "arg": null,
                "description": "Print a list of merge tools that may be used with --tool."
            },
            {
                "flag": "-y",
                "long": "--no-prompt",
                "arg": null,
                "description": "Don’t prompt before each invocation of the merge resolution program. This is the default if the merge resolution program is explicitly specified with the --tool option or with the merge.tool configuration variable."
            },
            {
                "flag": "",
                "long": "--prompt",
                "arg": null,
                "description": "Prompt before each invocation of the merge resolution program to give the user a chance to skip the path."
            },
            {
                "flag": "-g",
                "long": "--gui",
                "arg": null,
                "description": "When git-mergetool is invoked with the -g or --gui option the default merge tool will be read from the configured merge.guitool variable instead of merge.tool. If merge.guitool is not set, we will fallback to the tool configured under merge.tool."
            },
            {
                "flag": "",
                "long": "--no-gui",
                "arg": null,
                "description": "This overrides a previous -g or --gui setting and reads the default merge tool will be read from the configured merge.tool variable."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Process files in the order specified in the <orderfile>, which has one shell glob pattern per line. This overrides the diff.orderFile configuration variable (see git-config(1)). To cancel diff.orderFile, use -O/dev/null."
            }
        ],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 31,
                "subsections": [
                    {
                        "name": "--tool-help",
                        "lines": 2,
                        "long": "--tool-help"
                    },
                    {
                        "name": "-y, --no-prompt",
                        "lines": 4,
                        "flag": "-y",
                        "long": "--no-prompt"
                    },
                    {
                        "name": "--prompt",
                        "lines": 3,
                        "long": "--prompt"
                    },
                    {
                        "name": "-g, --gui",
                        "lines": 4,
                        "flag": "-g",
                        "long": "--gui"
                    },
                    {
                        "name": "--no-gui",
                        "lines": 3,
                        "long": "--no-gui"
                    },
                    {
                        "name": "-O<orderfile>",
                        "lines": 4
                    }
                ]
            },
            {
                "name": "CONFIGURATION",
                "lines": 66,
                "subsections": []
            },
            {
                "name": "TEMPORARY FILES",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "GIT",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "git-mergetool - Run merge conflict resolution tools to resolve merge conflicts\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "git mergetool [--tool=<tool>] [-y | --[no-]prompt] [<file>...]\n\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Use git mergetool to run one of several merge utilities to resolve merge conflicts. It is\ntypically run after git merge.\n\nIf one or more <file> parameters are given, the merge tool program will be run to resolve\ndifferences on each file (skipping those without conflicts). Specifying a directory will\ninclude all unresolved files in that path. If no <file> names are specified, git mergetool\nwill run the merge tool program on every file with merge conflicts.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "-t <tool>, --tool=<tool>\nUse the merge resolution program specified by <tool>. Valid values include emerge,\ngvimdiff, kdiff3, meld, vimdiff, and tortoisemerge. Run git mergetool --tool-help for the\nlist of valid <tool> settings.\n\nIf a merge resolution program is not specified, git mergetool will use the configuration\nvariable merge.tool. If the configuration variable merge.tool is not set, git mergetool\nwill pick a suitable default.\n\nYou can explicitly provide a full path to the tool by setting the configuration variable\nmergetool.<tool>.path. For example, you can configure the absolute path to kdiff3 by\nsetting mergetool.kdiff3.path. Otherwise, git mergetool assumes the tool is available in\nPATH.\n\nInstead of running one of the known merge tool programs, git mergetool can be customized\nto run an alternative program by specifying the command line to invoke in a configuration\nvariable mergetool.<tool>.cmd.\n\nWhen git mergetool is invoked with this tool (either through the -t or --tool option or\nthe merge.tool configuration variable) the configured command line will be invoked with\n$BASE set to the name of a temporary file containing the common base for the merge, if\navailable; $LOCAL set to the name of a temporary file containing the contents of the file\non the current branch; $REMOTE set to the name of a temporary file containing the\ncontents of the file to be merged, and $MERGED set to the name of the file to which the\nmerge tool should write the result of the merge resolution.\n\nIf the custom merge tool correctly indicates the success of a merge resolution with its\nexit code, then the configuration variable mergetool.<tool>.trustExitCode can be set to\ntrue. Otherwise, git mergetool will prompt the user to indicate the success of the\nresolution after the custom tool has exited.\n",
                "subsections": [
                    {
                        "name": "--tool-help",
                        "content": "Print a list of merge tools that may be used with --tool.\n",
                        "long": "--tool-help"
                    },
                    {
                        "name": "-y, --no-prompt",
                        "content": "Don’t prompt before each invocation of the merge resolution program. This is the default\nif the merge resolution program is explicitly specified with the --tool option or with\nthe merge.tool configuration variable.\n",
                        "flag": "-y",
                        "long": "--no-prompt"
                    },
                    {
                        "name": "--prompt",
                        "content": "Prompt before each invocation of the merge resolution program to give the user a chance\nto skip the path.\n",
                        "long": "--prompt"
                    },
                    {
                        "name": "-g, --gui",
                        "content": "When git-mergetool is invoked with the -g or --gui option the default merge tool will be\nread from the configured merge.guitool variable instead of merge.tool. If merge.guitool\nis not set, we will fallback to the tool configured under merge.tool.\n",
                        "flag": "-g",
                        "long": "--gui"
                    },
                    {
                        "name": "--no-gui",
                        "content": "This overrides a previous -g or --gui setting and reads the default merge tool will be\nread from the configured merge.tool variable.\n",
                        "long": "--no-gui"
                    },
                    {
                        "name": "-O<orderfile>",
                        "content": "Process files in the order specified in the <orderfile>, which has one shell glob pattern\nper line. This overrides the diff.orderFile configuration variable (see git-config(1)).\nTo cancel diff.orderFile, use -O/dev/null.\n"
                    }
                ]
            },
            "CONFIGURATION": {
                "content": "mergetool.<tool>.path\nOverride the path for the given tool. This is useful in case your tool is not in the\nPATH.\n\nmergetool.<tool>.cmd\nSpecify the command to invoke the specified merge tool. The specified command is\nevaluated in shell with the following variables available: BASE is the name of a\ntemporary file containing the common base of the files to be merged, if available; LOCAL\nis the name of a temporary file containing the contents of the file on the current\nbranch; REMOTE is the name of a temporary file containing the contents of the file from\nthe branch being merged; MERGED contains the name of the file to which the merge tool\nshould write the results of a successful merge.\n\nmergetool.<tool>.hideResolved\nAllows the user to override the global mergetool.hideResolved value for a specific tool.\nSee mergetool.hideResolved for the full description.\n\nmergetool.<tool>.trustExitCode\nFor a custom merge command, specify whether the exit code of the merge command can be\nused to determine whether the merge was successful. If this is not set to true then the\nmerge target file timestamp is checked and the merge assumed to have been successful if\nthe file has been updated, otherwise the user is prompted to indicate the success of the\nmerge.\n\nmergetool.meld.hasOutput\nOlder versions of meld do not support the --output option. Git will attempt to detect\nwhether meld supports --output by inspecting the output of meld --help. Configuring\nmergetool.meld.hasOutput will make Git skip these checks and use the configured value\ninstead. Setting mergetool.meld.hasOutput to true tells Git to unconditionally use the\n--output option, and false avoids using --output.\n\nmergetool.meld.useAutoMerge\nWhen the --auto-merge is given, meld will merge all non-conflicting parts automatically,\nhighlight the conflicting parts and wait for user decision. Setting\nmergetool.meld.useAutoMerge to true tells Git to unconditionally use the --auto-merge\noption with meld. Setting this value to auto makes git detect whether --auto-merge is\nsupported and will only use --auto-merge when available. A value of false avoids using\n--auto-merge altogether, and is the default value.\n\nmergetool.hideResolved\nDuring a merge Git will automatically resolve as many conflicts as possible and write the\nMERGED file containing conflict markers around any conflicts that it cannot resolve;\nLOCAL and REMOTE normally represent the versions of the file from before Git’s conflict\nresolution. This flag causes LOCAL and REMOTE to be overwriten so that only the\nunresolved conflicts are presented to the merge tool. Can be configured per-tool via the\nmergetool.<tool>.hideResolved configuration variable. Defaults to false.\n\nmergetool.keepBackup\nAfter performing a merge, the original file with conflict markers can be saved as a file\nwith a .orig extension. If this variable is set to false then this file is not preserved.\nDefaults to true (i.e. keep the backup files).\n\nmergetool.keepTemporaries\nWhen invoking a custom merge tool, Git uses a set of temporary files to pass to the tool.\nIf the tool returns an error and this variable is set to true, then these temporary files\nwill be preserved, otherwise they will be removed after the tool has exited. Defaults to\nfalse.\n\nmergetool.writeToTemp\nGit writes temporary BASE, LOCAL, and REMOTE versions of conflicting files in the\nworktree by default. Git will attempt to use a temporary directory for these files when\nset true. Defaults to false.\n\nmergetool.prompt\nPrompt before each invocation of the merge resolution program.\n",
                "subsections": []
            },
            "TEMPORARY FILES": {
                "content": "git mergetool creates *.orig backup files while resolving merges. These are safe to remove\nonce a file has been merged and its git mergetool session has completed.\n\nSetting the mergetool.keepBackup configuration variable to false causes git mergetool to\nautomatically remove the backup as files are successfully merged.\n",
                "subsections": []
            },
            "GIT": {
                "content": "Part of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                             GIT-MERGETOOL(1)",
                "subsections": []
            }
        }
    }
}