|
| 1 | +git-difftool(1) |
| 2 | +=============== |
| 3 | + |
| 4 | +NAME |
| 5 | +---- |
| 6 | +git-difftool - Show changes using common diff tools |
| 7 | + |
| 8 | +SYNOPSIS |
| 9 | +-------- |
| 10 | +[verse] |
| 11 | +'git difftool' [<options>] [<commit> [<commit>]] [--] [<path>...] |
| 12 | + |
| 13 | +DESCRIPTION |
| 14 | +----------- |
| 15 | +'git difftool' is a Git command that allows you to compare and edit files |
| 16 | +between revisions using common diff tools. 'git difftool' is a frontend |
| 17 | +to 'git diff' and accepts the same options and arguments. See |
| 18 | +linkgit:git-diff[1]. |
| 19 | + |
| 20 | +OPTIONS |
| 21 | +------- |
| 22 | +-d:: |
| 23 | +--dir-diff:: |
| 24 | + Copy the modified files to a temporary location and perform |
| 25 | + a directory diff on them. This mode never prompts before |
| 26 | + launching the diff tool. |
| 27 | + |
| 28 | +-y:: |
| 29 | +--no-prompt:: |
| 30 | + Do not prompt before launching a diff tool. |
| 31 | + |
| 32 | +--prompt:: |
| 33 | + Prompt before each invocation of the diff tool. |
| 34 | + This is the default behaviour; the option is provided to |
| 35 | + override any configuration settings. |
| 36 | + |
| 37 | +--rotate-to=<file>:: |
| 38 | + Start showing the diff for the given path, |
| 39 | + the paths before it will move to the end and output. |
| 40 | + |
| 41 | +--skip-to=<file>:: |
| 42 | + Start showing the diff for the given path, skipping all |
| 43 | + the paths before it. |
| 44 | + |
| 45 | +-t <tool>:: |
| 46 | +--tool=<tool>:: |
| 47 | + Use the diff tool specified by <tool>. Valid values include |
| 48 | + emerge, kompare, meld, and vimdiff. Run `git difftool --tool-help` |
| 49 | + for the list of valid <tool> settings. |
| 50 | ++ |
| 51 | +If a diff tool is not specified, 'git difftool' |
| 52 | +will use the configuration variable `diff.tool`. If the |
| 53 | +configuration variable `diff.tool` is not set, 'git difftool' |
| 54 | +will pick a suitable default. |
| 55 | ++ |
| 56 | +You can explicitly provide a full path to the tool by setting the |
| 57 | +configuration variable `difftool.<tool>.path`. For example, you |
| 58 | +can configure the absolute path to kdiff3 by setting |
| 59 | +`difftool.kdiff3.path`. Otherwise, 'git difftool' assumes the |
| 60 | +tool is available in PATH. |
| 61 | ++ |
| 62 | +Instead of running one of the known diff tools, |
| 63 | +'git difftool' can be customized to run an alternative program |
| 64 | +by specifying the command line to invoke in a configuration |
| 65 | +variable `difftool.<tool>.cmd`. |
| 66 | ++ |
| 67 | +When 'git difftool' is invoked with this tool (either through the |
| 68 | +`-t` or `--tool` option or the `diff.tool` configuration variable) |
| 69 | +the configured command line will be invoked with the following |
| 70 | +variables available: `$LOCAL` is set to the name of the temporary |
| 71 | +file containing the contents of the diff pre-image and `$REMOTE` |
| 72 | +is set to the name of the temporary file containing the contents |
| 73 | +of the diff post-image. `$MERGED` is the name of the file which is |
| 74 | +being compared. `$BASE` is provided for compatibility |
| 75 | +with custom merge tool commands and has the same value as `$MERGED`. |
| 76 | + |
| 77 | +--tool-help:: |
| 78 | + Print a list of diff tools that may be used with `--tool`. |
| 79 | + |
| 80 | +--[no-]symlinks:: |
| 81 | + 'git difftool''s default behavior is to create symlinks to the |
| 82 | + working tree when run in `--dir-diff` mode and the right-hand |
| 83 | + side of the comparison yields the same content as the file in |
| 84 | + the working tree. |
| 85 | ++ |
| 86 | +Specifying `--no-symlinks` instructs 'git difftool' to create copies |
| 87 | +instead. `--no-symlinks` is the default on Windows. |
| 88 | + |
| 89 | +-x <command>:: |
| 90 | +--extcmd=<command>:: |
| 91 | + Specify a custom command for viewing diffs. |
| 92 | + 'git-difftool' ignores the configured defaults and runs |
| 93 | + `<command> $LOCAL $REMOTE` when this option is specified. |
| 94 | + Additionally, `$BASE` is set in the environment. |
| 95 | + |
| 96 | +-g:: |
| 97 | +--[no-]gui:: |
| 98 | + When 'git-difftool' is invoked with the `-g` or `--gui` option |
| 99 | + the default diff tool will be read from the configured |
| 100 | + `diff.guitool` variable instead of `diff.tool`. This may be |
| 101 | + selected automatically using the configuration variable |
| 102 | + `difftool.guiDefault`. The `--no-gui` option can be used to |
| 103 | + override these settings. If `diff.guitool` is not set, we will |
| 104 | + fallback in the order of `merge.guitool`, `diff.tool`, |
| 105 | + `merge.tool` until a tool is found. |
| 106 | + |
| 107 | +--[no-]trust-exit-code:: |
| 108 | + Errors reported by the diff tool are ignored by default. |
| 109 | + Use `--trust-exit-code` to make 'git-difftool' exit when an |
| 110 | + invoked diff tool returns a non-zero exit code. |
| 111 | ++ |
| 112 | +'git-difftool' will forward the exit code of the invoked tool when |
| 113 | +`--trust-exit-code` is used. |
| 114 | + |
| 115 | +See linkgit:git-diff[1] for the full list of supported options. |
| 116 | + |
| 117 | +CONFIGURATION |
| 118 | +------------- |
| 119 | +'git difftool' falls back to 'git mergetool' config variables when the |
| 120 | +difftool equivalents have not been defined. |
| 121 | + |
| 122 | +Everything above this line in this section isn't included from the |
| 123 | +linkgit:git-config[1] documentation. The content that follows is the |
| 124 | +same as what's found there: |
| 125 | + |
| 126 | + |
| 127 | +diff.tool:: |
| 128 | + Controls which diff tool is used by linkgit:git-difftool[1]. |
| 129 | + This variable overrides the value configured in `merge.tool`. |
| 130 | + The list below shows the valid built-in values. |
| 131 | + Any other value is treated as a custom diff tool and requires |
| 132 | + that a corresponding difftool.<tool>.cmd variable is defined. |
| 133 | + |
| 134 | +diff.guitool:: |
| 135 | + Controls which diff tool is used by linkgit:git-difftool[1] when |
| 136 | + the -g/--gui flag is specified. This variable overrides the value |
| 137 | + configured in `merge.guitool`. The list below shows the valid |
| 138 | + built-in values. Any other value is treated as a custom diff tool |
| 139 | + and requires that a corresponding difftool.<guitool>.cmd variable |
| 140 | + is defined. |
| 141 | + |
| 142 | + * araxis |
| 143 | + * bc |
| 144 | + * codecompare |
| 145 | + * deltawalker |
| 146 | + * diffmerge |
| 147 | + * diffuse |
| 148 | + * ecmerge |
| 149 | + * emerge |
| 150 | + * examdiff |
| 151 | + * guiffy |
| 152 | + * gvimdiff |
| 153 | + * kdiff3 |
| 154 | + * kompare |
| 155 | + * meld |
| 156 | + * nvimdiff |
| 157 | + * opendiff |
| 158 | + * p4merge |
| 159 | + * smerge |
| 160 | + * tkdiff |
| 161 | + * vimdiff |
| 162 | + * vscode |
| 163 | + * winmerge |
| 164 | + * xxdiff |
| 165 | + |
| 166 | + |
| 167 | +difftool.<tool>.cmd:: |
| 168 | + Specify the command to invoke the specified diff tool. |
| 169 | + The specified command is evaluated in shell with the following |
| 170 | + variables available: 'LOCAL' is set to the name of the temporary |
| 171 | + file containing the contents of the diff pre-image and 'REMOTE' |
| 172 | + is set to the name of the temporary file containing the contents |
| 173 | + of the diff post-image. |
| 174 | ++ |
| 175 | +See the `--tool=<tool>` option in linkgit:git-difftool[1] for more details. |
| 176 | + |
| 177 | +difftool.<tool>.path:: |
| 178 | + Override the path for the given tool. This is useful in case |
| 179 | + your tool is not in the PATH. |
| 180 | + |
| 181 | +difftool.trustExitCode:: |
| 182 | + Exit difftool if the invoked diff tool returns a non-zero exit status. |
| 183 | ++ |
| 184 | +See the `--trust-exit-code` option in linkgit:git-difftool[1] for more details. |
| 185 | + |
| 186 | +difftool.prompt:: |
| 187 | + Prompt before each invocation of the diff tool. |
| 188 | + |
| 189 | +difftool.guiDefault:: |
| 190 | + Set `true` to use the `diff.guitool` by default (equivalent to specifying |
| 191 | + the `--gui` argument), or `auto` to select `diff.guitool` or `diff.tool` |
| 192 | + depending on the presence of a `DISPLAY` environment variable value. The |
| 193 | + default is `false`, where the `--gui` argument must be provided |
| 194 | + explicitly for the `diff.guitool` to be used. |
| 195 | + |
| 196 | + |
| 197 | +SEE ALSO |
| 198 | +-------- |
| 199 | +linkgit:git-diff[1]:: |
| 200 | + Show changes between commits, commit and working tree, etc |
| 201 | + |
| 202 | +linkgit:git-mergetool[1]:: |
| 203 | + Run merge conflict resolution tools to resolve merge conflicts |
| 204 | + |
| 205 | +linkgit:git-config[1]:: |
| 206 | + Get and set repository or global options |
| 207 | + |
| 208 | +GIT |
| 209 | +--- |
| 210 | +Part of the linkgit:git[1] suite |
0 commit comments