]>
Commit | Line | Data |
---|---|---|
5c38ea31 DA |
1 | git-difftool(1) |
2 | =============== | |
3 | ||
4 | NAME | |
5 | ---- | |
8b733222 | 6 | git-difftool - Show changes using common diff tools |
5c38ea31 DA |
7 | |
8 | SYNOPSIS | |
9 | -------- | |
7791a1d9 | 10 | [verse] |
9edb8a0f | 11 | 'git difftool' [<options>] [<commit> [<commit>]] [--] [<path>...] |
5c38ea31 DA |
12 | |
13 | DESCRIPTION | |
14 | ----------- | |
2de9b711 | 15 | 'git difftool' is a Git command that allows you to compare and edit files |
8b733222 | 16 | between revisions using common diff tools. 'git difftool' is a frontend |
49bd56a5 JK |
17 | to 'git diff' and accepts the same options and arguments. See |
18 | linkgit:git-diff[1]. | |
5c38ea31 DA |
19 | |
20 | OPTIONS | |
21 | ------- | |
7e0abcec TH |
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 | ||
8b733222 DA |
28 | -y:: |
29 | --no-prompt:: | |
30 | Do not prompt before launching a diff tool. | |
31 | ||
a904392e DA |
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 | ||
1c881026 ZH |
37 | --rotate-to=<file>:: |
38 | Start showing the diff for the given path, | |
39 | the paths before it will move to 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 | ||
5c38ea31 DA |
45 | -t <tool>:: |
46 | --tool=<tool>:: | |
bf73fc21 TH |
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. | |
5c38ea31 | 50 | + |
0b444cdb | 51 | If a diff tool is not specified, 'git difftool' |
2464456a | 52 | will use the configuration variable `diff.tool`. If the |
0b444cdb | 53 | configuration variable `diff.tool` is not set, 'git difftool' |
5c38ea31 DA |
54 | will pick a suitable default. |
55 | + | |
56 | You can explicitly provide a full path to the tool by setting the | |
2464456a | 57 | configuration variable `difftool.<tool>.path`. For example, you |
5c38ea31 | 58 | can configure the absolute path to kdiff3 by setting |
0b444cdb | 59 | `difftool.kdiff3.path`. Otherwise, 'git difftool' assumes the |
5c38ea31 DA |
60 | tool is available in PATH. |
61 | + | |
8b733222 | 62 | Instead of running one of the known diff tools, |
0b444cdb | 63 | 'git difftool' can be customized to run an alternative program |
5c38ea31 | 64 | by specifying the command line to invoke in a configuration |
2464456a | 65 | variable `difftool.<tool>.cmd`. |
5c38ea31 | 66 | + |
0b444cdb | 67 | When 'git difftool' is invoked with this tool (either through the |
2464456a | 68 | `-t` or `--tool` option or the `diff.tool` configuration variable) |
5c38ea31 DA |
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 | |
51baceee MG |
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`. | |
5c38ea31 | 76 | |
7a30747f DA |
77 | --tool-help:: |
78 | Print a list of diff tools that may be used with `--tool`. | |
79 | ||
0460ed2c | 80 | --[no-]symlinks:: |
1f229345 | 81 | 'git difftool''s default behavior is create symlinks to the |
02c56314 JK |
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. | |
1f229345 | 85 | + |
8aa10d4a JK |
86 | Specifying `--no-symlinks` instructs 'git difftool' to create copies |
87 | instead. `--no-symlinks` is the default on Windows. | |
1f229345 | 88 | |
f47f1e2c | 89 | -x <command>:: |
1c6f5b52 DA |
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. | |
4a689afb | 94 | Additionally, `$BASE` is set in the environment. |
1c6f5b52 | 95 | |
4cefa495 | 96 | -g:: |
56c2da57 | 97 | --[no-]gui:: |
4cefa495 DA |
98 | When 'git-difftool' is invoked with the `-g` or `--gui` option |
99 | the default diff tool will be read from the configured | |
56c2da57 | 100 | `diff.guitool` variable instead of `diff.tool`. The `--no-gui` |
6c22d715 DL |
101 | option can be used to override this setting. If `diff.guitool` |
102 | is not set, we will fallback in the order of `merge.guitool`, | |
103 | `diff.tool`, `merge.tool` until a tool is found. | |
4cefa495 | 104 | |
2b52123f DA |
105 | --[no-]trust-exit-code:: |
106 | 'git-difftool' invokes a diff tool individually on each file. | |
107 | Errors reported by the diff tool are ignored by default. | |
108 | Use `--trust-exit-code` to make 'git-difftool' exit when an | |
109 | invoked diff tool returns a non-zero exit code. | |
110 | + | |
111 | 'git-difftool' will forward the exit code of the invoked tool when | |
bcf9626a | 112 | `--trust-exit-code` is used. |
2b52123f | 113 | |
8b733222 | 114 | See linkgit:git-diff[1] for the full list of supported options. |
5c38ea31 DA |
115 | |
116 | CONFIG VARIABLES | |
117 | ---------------- | |
0b444cdb | 118 | 'git difftool' falls back to 'git mergetool' config variables when the |
2464456a | 119 | difftool equivalents have not been defined. |
5c38ea31 | 120 | |
2464456a | 121 | diff.tool:: |
8b733222 | 122 | The default diff tool to use. |
5c38ea31 | 123 | |
4cefa495 DA |
124 | diff.guitool:: |
125 | The default diff tool to use when `--gui` is specified. | |
126 | ||
2464456a | 127 | difftool.<tool>.path:: |
5c38ea31 DA |
128 | Override the path for the given tool. This is useful in case |
129 | your tool is not in the PATH. | |
130 | ||
2464456a | 131 | difftool.<tool>.cmd:: |
8b733222 | 132 | Specify the command to invoke the specified diff tool. |
5c38ea31 DA |
133 | + |
134 | See the `--tool=<tool>` option above for more details. | |
135 | ||
a904392e DA |
136 | difftool.prompt:: |
137 | Prompt before each invocation of the diff tool. | |
138 | ||
2b52123f DA |
139 | difftool.trustExitCode:: |
140 | Exit difftool if the invoked diff tool returns a non-zero exit status. | |
141 | + | |
142 | See the `--trust-exit-code` option above for more details. | |
143 | ||
5c38ea31 DA |
144 | SEE ALSO |
145 | -------- | |
507cfcbd | 146 | linkgit:git-diff[1]:: |
5c38ea31 DA |
147 | Show changes between commits, commit and working tree, etc |
148 | ||
149 | linkgit:git-mergetool[1]:: | |
150 | Run merge conflict resolution tools to resolve merge conflicts | |
151 | ||
507cfcbd | 152 | linkgit:git-config[1]:: |
5c38ea31 DA |
153 | Get and set repository or global options |
154 | ||
5c38ea31 DA |
155 | GIT |
156 | --- | |
157 | Part of the linkgit:git[1] suite |