Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 1 | git-difftool(1) |
| 2 | =============== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | git-difftool - Show changes using common diff tools |
| 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 10 | [verse] |
Junio C Hamano | 2e6ded8 | 2010-12-05 06:20:48 | [diff] [blame] | 11 | 'git difftool' [<options>] [<commit> [<commit>]] [--] [<path>...] |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 12 | |
| 13 | DESCRIPTION |
| 14 | ----------- |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 15 | 'git difftool' is a Git command that allows you to compare and edit files |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 16 | between revisions using common diff tools. 'git difftool' is a frontend |
Junio C Hamano | 2e6ded8 | 2010-12-05 06:20:48 | [diff] [blame] | 17 | to 'git diff' and accepts the same options and arguments. See |
| 18 | linkgit:git-diff[1]. |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 19 | |
| 20 | OPTIONS |
| 21 | ------- |
Junio C Hamano | bcdb12e | 2012-05-10 18:45:15 | [diff] [blame] | 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 | |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 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 | |
Junio C Hamano | a372d5b | 2021-02-26 01:34:37 | [diff] [blame] | 37 | --rotate-to=<file>:: |
| 38 | Start showing the diff for the given path, |
Junio C Hamano | 33be821 | 2023-10-23 21:45:54 | [diff] [blame] | 39 | the paths before it will move to the end and output. |
Junio C Hamano | a372d5b | 2021-02-26 01:34:37 | [diff] [blame] | 40 | |
| 41 | --skip-to=<file>:: |
| 42 | Start showing the diff for the given path, skipping all |
| 43 | the paths before it. |
| 44 | |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 45 | -t <tool>:: |
| 46 | --tool=<tool>:: |
Junio C Hamano | bcdb12e | 2012-05-10 18:45:15 | [diff] [blame] | 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. |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 50 | + |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 51 | If a diff tool is not specified, 'git difftool' |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 52 | will use the configuration variable `diff.tool`. If the |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 53 | configuration variable `diff.tool` is not set, 'git difftool' |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 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 |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 59 | `difftool.kdiff3.path`. Otherwise, 'git difftool' assumes the |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 60 | tool is available in PATH. |
| 61 | + |
| 62 | Instead of running one of the known diff tools, |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 63 | 'git difftool' can be customized to run an alternative program |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 64 | by specifying the command line to invoke in a configuration |
| 65 | variable `difftool.<tool>.cmd`. |
| 66 | + |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 67 | When 'git difftool' is invoked with this tool (either through the |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 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 |
Junio C Hamano | 0d75e87 | 2010-12-17 06:57:26 | [diff] [blame] | 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`. |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 76 | |
Junio C Hamano | bcdb12e | 2012-05-10 18:45:15 | [diff] [blame] | 77 | --tool-help:: |
| 78 | Print a list of diff tools that may be used with `--tool`. |
| 79 | |
Junio C Hamano | 3d1b5a1 | 2013-05-17 23:34:02 | [diff] [blame] | 80 | --[no-]symlinks:: |
Junio C Hamano | 33be821 | 2023-10-23 21:45:54 | [diff] [blame] | 81 | 'git difftool''s default behavior is to create symlinks to the |
Junio C Hamano | 778a341 | 2013-03-28 23:24:30 | [diff] [blame] | 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. |
Junio C Hamano | a00504d | 2012-08-27 21:11:23 | [diff] [blame] | 85 | + |
Junio C Hamano | 778a341 | 2013-03-28 23:24:30 | [diff] [blame] | 86 | Specifying `--no-symlinks` instructs 'git difftool' to create copies |
| 87 | instead. `--no-symlinks` is the default on Windows. |
Junio C Hamano | a00504d | 2012-08-27 21:11:23 | [diff] [blame] | 88 | |
Junio C Hamano | a9701f0 | 2010-01-21 00:42:16 | [diff] [blame] | 89 | -x <command>:: |
| 90 | --extcmd=<command>:: |
| 91 | Specify a custom command for viewing diffs. |
| 92 | 'git-difftool' ignores the configured defaults and runs |
Junio C Hamano | 6546a50 | 2024-02-08 23:48:36 | [diff] [blame] | 93 | `<command> $LOCAL $REMOTE` when this option is specified. |
Junio C Hamano | 0d75e87 | 2010-12-17 06:57:26 | [diff] [blame] | 94 | Additionally, `$BASE` is set in the environment. |
Junio C Hamano | a9701f0 | 2010-01-21 00:42:16 | [diff] [blame] | 95 | |
| 96 | -g:: |
Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 97 | --[no-]gui:: |
Junio C Hamano | a9701f0 | 2010-01-21 00:42:16 | [diff] [blame] | 98 | When 'git-difftool' is invoked with the `-g` or `--gui` option |
| 99 | the default diff tool will be read from the configured |
Junio C Hamano | 4304bf6 | 2023-04-18 04:55:35 | [diff] [blame] | 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. |
Junio C Hamano | a9701f0 | 2010-01-21 00:42:16 | [diff] [blame] | 106 | |
Junio C Hamano | 2a4bcbc | 2014-10-29 20:07:39 | [diff] [blame] | 107 | --[no-]trust-exit-code:: |
Junio C Hamano | 2a4bcbc | 2014-10-29 20:07:39 | [diff] [blame] | 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 |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 113 | `--trust-exit-code` is used. |
Junio C Hamano | 2a4bcbc | 2014-10-29 20:07:39 | [diff] [blame] | 114 | |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 115 | See linkgit:git-diff[1] for the full list of supported options. |
| 116 | |
Junio C Hamano | ba8baee | 2022-09-14 20:25:23 | [diff] [blame] | 117 | CONFIGURATION |
| 118 | ------------- |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 119 | 'git difftool' falls back to 'git mergetool' config variables when the |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 120 | difftool equivalents have not been defined. |
| 121 | |
Junio C Hamano | ba8baee | 2022-09-14 20:25:23 | [diff] [blame] | 122 | include::includes/cmd-config-section-rest.txt[] |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 123 | |
Junio C Hamano | ba8baee | 2022-09-14 20:25:23 | [diff] [blame] | 124 | include::config/difftool.txt[] |
Junio C Hamano | 2a4bcbc | 2014-10-29 20:07:39 | [diff] [blame] | 125 | |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 126 | SEE ALSO |
| 127 | -------- |
| 128 | linkgit:git-diff[1]:: |
| 129 | Show changes between commits, commit and working tree, etc |
| 130 | |
| 131 | linkgit:git-mergetool[1]:: |
| 132 | Run merge conflict resolution tools to resolve merge conflicts |
| 133 | |
| 134 | linkgit:git-config[1]:: |
| 135 | Get and set repository or global options |
| 136 | |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 137 | GIT |
| 138 | --- |
| 139 | Part of the linkgit:git[1] suite |