blob: 855a1ae3c495138bd784fd7e89de317166814006 [file] [log] [blame]
'\" t
.\" Title: git-mergetool
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 02/24/2019
.\" Manual: Git Manual
.\" Source: Git 2.21.0
.\" Language: English
.\"
.TH "GIT\-MERGETOOL" "1" "02/24/2019" "Git 2\&.21\&.0" "Git Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git-mergetool \- Run merge conflict resolution tools to resolve merge conflicts
.SH "SYNOPSIS"
.sp
.nf
\fIgit mergetool\fR [\-\-tool=<tool>] [\-y | \-\-[no\-]prompt] [<file>\&...]
.fi
.sp
.SH "DESCRIPTION"
.sp
Use \fBgit mergetool\fR to run one of several merge utilities to resolve merge conflicts\&. It is typically run after \fIgit merge\fR\&.
.sp
If one or more <file> parameters are given, the merge tool program will be run to resolve differences on each file (skipping those without conflicts)\&. Specifying a directory will include all unresolved files in that path\&. If no <file> names are specified, \fIgit mergetool\fR will run the merge tool program on every file with merge conflicts\&.
.SH "OPTIONS"
.PP
\-t <tool>, \-\-tool=<tool>
.RS 4
Use the merge resolution program specified by <tool>\&. Valid values include emerge, gvimdiff, kdiff3, meld, vimdiff, and tortoisemerge\&. Run
\fBgit mergetool \-\-tool\-help\fR
for the list of valid <tool> settings\&.
.sp
If a merge resolution program is not specified,
\fIgit mergetool\fR
will use the configuration variable
\fBmerge\&.tool\fR\&. If the configuration variable
\fBmerge\&.tool\fR
is not set,
\fIgit mergetool\fR
will pick a suitable default\&.
.sp
You can explicitly provide a full path to the tool by setting the configuration variable
\fBmergetool\&.<tool>\&.path\fR\&. For example, you can configure the absolute path to kdiff3 by setting
\fBmergetool\&.kdiff3\&.path\fR\&. Otherwise,
\fIgit mergetool\fR
assumes the tool is available in PATH\&.
.sp
Instead of running one of the known merge tool programs,
\fIgit mergetool\fR
can be customized to run an alternative program by specifying the command line to invoke in a configuration variable
\fBmergetool\&.<tool>\&.cmd\fR\&.
.sp
When
\fIgit mergetool\fR
is invoked with this tool (either through the
\fB\-t\fR
or
\fB\-\-tool\fR
option or the
\fBmerge\&.tool\fR
configuration variable) the configured command line will be invoked with
\fB$BASE\fR
set to the name of a temporary file containing the common base for the merge, if available;
\fB$LOCAL\fR
set to the name of a temporary file containing the contents of the file on the current branch;
\fB$REMOTE\fR
set to the name of a temporary file containing the contents of the file to be merged, and
\fB$MERGED\fR
set to the name of the file to which the merge tool should write the result of the merge resolution\&.
.sp
If the custom merge tool correctly indicates the success of a merge resolution with its exit code, then the configuration variable
\fBmergetool\&.<tool>\&.trustExitCode\fR
can be set to
\fBtrue\fR\&. Otherwise,
\fIgit mergetool\fR
will prompt the user to indicate the success of the resolution after the custom tool has exited\&.
.RE
.PP
\-\-tool\-help
.RS 4
Print a list of merge tools that may be used with
\fB\-\-tool\fR\&.
.RE
.PP
\-y, \-\-no\-prompt
.RS 4
Don\(cqt prompt before each invocation of the merge resolution program\&. This is the default if the merge resolution program is explicitly specified with the
\fB\-\-tool\fR
option or with the
\fBmerge\&.tool\fR
configuration variable\&.
.RE
.PP
\-\-prompt
.RS 4
Prompt before each invocation of the merge resolution program to give the user a chance to skip the path\&.
.RE
.PP
\-g, \-\-gui
.RS 4
When
\fIgit\-mergetool\fR
is invoked with the
\fB\-g\fR
or
\fB\-\-gui\fR
option the default merge tool will be read from the configured
\fBmerge\&.guitool\fR
variable instead of
\fBmerge\&.tool\fR\&.
.RE
.PP
\-\-no\-gui
.RS 4
This overrides a previous
\fB\-g\fR
or
\fB\-\-gui\fR
setting and reads the default merge tool will be read from the configured
\fBmerge\&.tool\fR
variable\&.
.RE
.PP
\-O<orderfile>
.RS 4
Process files in the order specified in the <orderfile>, which has one shell glob pattern per line\&. This overrides the
\fBdiff\&.orderFile\fR
configuration variable (see
\fBgit-config\fR(1))\&. To cancel
\fBdiff\&.orderFile\fR, use
\fB\-O/dev/null\fR\&.
.RE
.SH "TEMPORARY FILES"
.sp
\fBgit mergetool\fR creates \fB*\&.orig\fR backup files while resolving merges\&. These are safe to remove once a file has been merged and its \fBgit mergetool\fR session has completed\&.
.sp
Setting the \fBmergetool\&.keepBackup\fR configuration variable to \fBfalse\fR causes \fBgit mergetool\fR to automatically remove the backup as files are successfully merged\&.
.SH "GIT"
.sp
Part of the \fBgit\fR(1) suite