Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 1 | // Please don't remove this comment as asciidoc behaves badly when |
| 2 | // the first non-empty line is ifdef/ifndef. The symptom is that |
| 3 | // without this comment the <git-diff-core> attribute conditionally |
| 4 | // defined below ends up being defined unconditionally. |
| 5 | // Last checked with asciidoc 7.0.2. |
| 6 | |
| 7 | ifndef::git-format-patch[] |
| 8 | ifndef::git-diff[] |
Junio C Hamano | 00b8b63 | 2007-12-07 09:50:49 | [diff] [blame] | 9 | ifndef::git-log[] |
Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 10 | :git-diff-core: 1 |
Junio C Hamano | 00b8b63 | 2007-12-07 09:50:49 | [diff] [blame] | 11 | endif::git-log[] |
Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 12 | endif::git-diff[] |
| 13 | endif::git-format-patch[] |
| 14 | |
| 15 | ifdef::git-format-patch[] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 16 | -p:: |
Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 17 | Generate patches without diffstat. |
| 18 | endif::git-format-patch[] |
| 19 | |
| 20 | ifndef::git-format-patch[] |
| 21 | -p:: |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 22 | -u:: |
Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 23 | Generate patch (see section on generating patches). |
| 24 | {git-diff? This is the default.} |
| 25 | endif::git-format-patch[] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 26 | |
Junio C Hamano | 6936156 | 2007-07-26 02:14:34 | [diff] [blame] | 27 | -U<n>:: |
Junio C Hamano | 6936156 | 2007-07-26 02:14:34 | [diff] [blame] | 28 | --unified=<n>:: |
| 29 | Generate diffs with <n> lines of context instead of |
| 30 | the usual three. Implies "-p". |
| 31 | |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 32 | --raw:: |
| 33 | Generate the raw format. |
Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 34 | {git-diff-core? This is the default.} |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 35 | |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 36 | --patch-with-raw:: |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 37 | Synonym for "-p --raw". |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 38 | |
Junio C Hamano | 20d47e3 | 2009-01-26 06:36:02 | [diff] [blame] | 39 | --patience:: |
Junio C Hamano | 22bcc11 | 2009-01-24 08:05:18 | [diff] [blame] | 40 | Generate a diff using the "patience diff" algorithm. |
| 41 | |
Junio C Hamano | 4a9a76a | 2006-10-01 05:40:29 | [diff] [blame] | 42 | --stat[=width[,name-width]]:: |
| 43 | Generate a diffstat. You can override the default |
| 44 | output width for 80-column terminal by "--stat=width". |
| 45 | The width of the filename part can be controlled by |
| 46 | giving another width to it separated by a comma. |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 47 | |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 48 | --numstat:: |
| 49 | Similar to \--stat, but shows number of added and |
| 50 | deleted lines in decimal notation and pathname without |
Junio C Hamano | d793de5 | 2006-12-26 09:11:43 | [diff] [blame] | 51 | abbreviation, to make it more machine friendly. For |
| 52 | binary files, outputs two `-` instead of saying |
| 53 | `0 0`. |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 54 | |
Junio C Hamano | 7d23f5e | 2006-12-16 07:44:04 | [diff] [blame] | 55 | --shortstat:: |
| 56 | Output only the last line of the --stat format containing total |
| 57 | number of modified files, as well as number of added and deleted |
| 58 | lines. |
| 59 | |
Junio C Hamano | 6a45be9 | 2008-04-22 08:19:03 | [diff] [blame] | 60 | --dirstat[=limit]:: |
Junio C Hamano | a2f4662 | 2008-09-03 05:20:31 | [diff] [blame] | 61 | Output the distribution of relative amount of changes (number of lines added or |
| 62 | removed) for each sub-directory. Directories with changes below |
| 63 | a cut-off percent (3% by default) are not shown. The cut-off percent |
| 64 | can be set with "--dirstat=limit". Changes in a child directory is not |
| 65 | counted for the parent directory, unless "--cumulative" is used. |
Junio C Hamano | 6a45be9 | 2008-04-22 08:19:03 | [diff] [blame] | 66 | |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 67 | --dirstat-by-file[=limit]:: |
| 68 | Same as --dirstat, but counts changed files instead of lines. |
| 69 | |
Junio C Hamano | 6959c6c | 2006-05-17 10:34:11 | [diff] [blame] | 70 | --summary:: |
| 71 | Output a condensed summary of extended header information |
| 72 | such as creations, renames and mode changes. |
| 73 | |
Junio C Hamano | d1308c9 | 2006-04-16 11:01:09 | [diff] [blame] | 74 | --patch-with-stat:: |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 75 | Synonym for "-p --stat". |
Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 76 | {git-format-patch? This is the default.} |
Junio C Hamano | d1308c9 | 2006-04-16 11:01:09 | [diff] [blame] | 77 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 78 | -z:: |
Junio C Hamano | b968dbb | 2007-07-27 07:26:40 | [diff] [blame] | 79 | NUL-line termination on output. This affects the --raw |
| 80 | output field terminator. Also output from commands such |
| 81 | as "git-log" will be delimited with NUL between commits. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 82 | |
| 83 | --name-only:: |
| 84 | Show only names of changed files. |
| 85 | |
| 86 | --name-status:: |
Junio C Hamano | a9aee78 | 2008-04-23 16:09:20 | [diff] [blame] | 87 | Show only names and status of changed files. See the description |
| 88 | of the `--diff-filter` option on what the status letters mean. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 89 | |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 90 | --color:: |
| 91 | Show colored diff. |
| 92 | |
| 93 | --no-color:: |
| 94 | Turn off colored diff, even when the configuration file |
| 95 | gives the default to color output. |
| 96 | |
Junio C Hamano | 20d47e3 | 2009-01-26 06:36:02 | [diff] [blame] | 97 | --color-words[=<regex>]:: |
| 98 | Show colored word diff, i.e., color words which have changed. |
| 99 | By default, words are separated by whitespace. |
| 100 | + |
| 101 | When a <regex> is specified, every non-overlapping match of the |
| 102 | <regex> is considered a word. Anything between these matches is |
| 103 | considered whitespace and ignored(!) for the purposes of finding |
| 104 | differences. You may want to append `|[^[:space:]]` to your regular |
| 105 | expression to make sure that it matches all non-whitespace characters. |
| 106 | A match that contains a newline is silently truncated(!) at the |
| 107 | newline. |
| 108 | + |
| 109 | The regex can also be set via a diff driver or configuration option, see |
| 110 | linkgit:gitattributes[1] or linkgit:git-config[1]. Giving it explicitly |
| 111 | overrides any diff driver or configuration setting. Diff drivers |
| 112 | override configuration settings. |
Junio C Hamano | 85e45fa | 2006-08-13 07:47:41 | [diff] [blame] | 113 | |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 114 | --no-renames:: |
| 115 | Turn off rename detection, even when the configuration |
| 116 | file gives the default to do so. |
| 117 | |
Junio C Hamano | a890c4f | 2007-01-28 10:29:21 | [diff] [blame] | 118 | --check:: |
| 119 | Warn if changes introduce trailing whitespace |
Junio C Hamano | 3dac504 | 2007-12-15 08:40:54 | [diff] [blame] | 120 | or an indent that uses a space before a tab. Exits with |
| 121 | non-zero status if problems are found. Not compatible with |
| 122 | --exit-code. |
Junio C Hamano | a890c4f | 2007-01-28 10:29:21 | [diff] [blame] | 123 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 124 | --full-index:: |
Junio C Hamano | 5cf43ca | 2008-08-20 09:14:14 | [diff] [blame] | 125 | Instead of the first handful of characters, show the full |
| 126 | pre- and post-image blob object names on the "index" |
| 127 | line when generating patch format output. |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 128 | |
| 129 | --binary:: |
| 130 | In addition to --full-index, output "binary diff" that |
| 131 | can be applied with "git apply". |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 132 | |
| 133 | --abbrev[=<n>]:: |
| 134 | Instead of showing the full 40-byte hexadecimal object |
| 135 | name in diff-raw format output and diff-tree header |
Junio C Hamano | 6efe302 | 2009-01-13 16:47:56 | [diff] [blame] | 136 | lines, show only a partial prefix. This is |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 137 | independent of --full-index option above, which controls |
| 138 | the diff-patch output format. Non default number of |
| 139 | digits can be specified with --abbrev=<n>. |
| 140 | |
| 141 | -B:: |
| 142 | Break complete rewrite changes into pairs of delete and create. |
| 143 | |
| 144 | -M:: |
| 145 | Detect renames. |
| 146 | |
| 147 | -C:: |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 148 | Detect copies as well as renames. See also `--find-copies-harder`. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 149 | |
Junio C Hamano | 6ec31b9 | 2006-02-10 05:52:01 | [diff] [blame] | 150 | --diff-filter=[ACDMRTUXB*]:: |
| 151 | Select only files that are Added (`A`), Copied (`C`), |
| 152 | Deleted (`D`), Modified (`M`), Renamed (`R`), have their |
Junio C Hamano | a2deec5 | 2008-10-18 18:58:09 | [diff] [blame] | 153 | type (i.e. regular file, symlink, submodule, ...) changed (`T`), |
| 154 | are Unmerged (`U`), are |
Junio C Hamano | 6ec31b9 | 2006-02-10 05:52:01 | [diff] [blame] | 155 | Unknown (`X`), or have had their pairing Broken (`B`). |
| 156 | Any combination of the filter characters may be used. |
| 157 | When `*` (All-or-none) is added to the combination, all |
| 158 | paths are selected if there is any file that matches |
| 159 | other criteria in the comparison; if there is no file |
| 160 | that matches other criteria, nothing is selected. |
| 161 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 162 | --find-copies-harder:: |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 163 | For performance reasons, by default, `-C` option finds copies only |
Junio C Hamano | a77a513 | 2007-06-08 16:13:44 | [diff] [blame] | 164 | if the original file of the copy was modified in the same |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 165 | changeset. This flag makes the command |
| 166 | inspect unmodified files as candidates for the source of |
| 167 | copy. This is a very expensive operation for large |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 168 | projects, so use it with caution. Giving more than one |
| 169 | `-C` option has the same effect. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 170 | |
| 171 | -l<num>:: |
| 172 | -M and -C options require O(n^2) processing time where n |
| 173 | is the number of potential rename/copy targets. This |
| 174 | option prevents rename/copy detection from running if |
| 175 | the number of rename/copy targets exceeds the specified |
| 176 | number. |
| 177 | |
| 178 | -S<string>:: |
Junio C Hamano | 5217a27 | 2009-03-21 00:39:33 | [diff] [blame] | 179 | Look for differences that introduce or remove an instance of |
| 180 | <string>. Note that this is different than the string simply |
| 181 | appearing in diff output; see the 'pickaxe' entry in |
| 182 | linkgit:gitdiffcore[7] for more details. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 183 | |
| 184 | --pickaxe-all:: |
| 185 | When -S finds a change, show all the changes in that |
| 186 | changeset, not just the files that contain the change |
| 187 | in <string>. |
| 188 | |
Junio C Hamano | bfe9e75 | 2006-04-05 21:43:28 | [diff] [blame] | 189 | --pickaxe-regex:: |
| 190 | Make the <string> not a plain string but an extended POSIX |
| 191 | regex to match. |
| 192 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 193 | -O<orderfile>:: |
| 194 | Output the patch in the order specified in the |
| 195 | <orderfile>, which has one shell glob pattern per line. |
| 196 | |
| 197 | -R:: |
| 198 | Swap two inputs; that is, show differences from index or |
| 199 | on-disk file to tree contents. |
| 200 | |
Junio C Hamano | 24bc09a | 2008-02-28 00:27:44 | [diff] [blame] | 201 | --relative[=<path>]:: |
| 202 | When run from a subdirectory of the project, it can be |
| 203 | told to exclude changes outside the directory and show |
| 204 | pathnames relative to it with this option. When you are |
| 205 | not in a subdirectory (e.g. in a bare repository), you |
| 206 | can name which subdirectory to make the output relative |
| 207 | to by giving a <path> as an argument. |
| 208 | |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 209 | -a:: |
Junio C Hamano | c26f548 | 2006-07-09 09:38:14 | [diff] [blame] | 210 | --text:: |
| 211 | Treat all files as text. |
| 212 | |
Junio C Hamano | fd46896 | 2007-02-14 23:45:04 | [diff] [blame] | 213 | --ignore-space-at-eol:: |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 214 | Ignore changes in whitespace at EOL. |
Junio C Hamano | fd46896 | 2007-02-14 23:45:04 | [diff] [blame] | 215 | |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 216 | -b:: |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 217 | --ignore-space-change:: |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 218 | Ignore changes in amount of whitespace. This ignores whitespace |
| 219 | at line end, and considers all other sequences of one or |
| 220 | more whitespace characters to be equivalent. |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 221 | |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 222 | -w:: |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 223 | --ignore-all-space:: |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 224 | Ignore whitespace when comparing lines. This ignores |
| 225 | differences even if one line has whitespace where the other |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 226 | line has none. |
| 227 | |
Junio C Hamano | 1d40ee8 | 2009-01-07 10:14:16 | [diff] [blame] | 228 | --inter-hunk-context=<lines>:: |
| 229 | Show the context between diff hunks, up to the specified number |
| 230 | of lines, thereby fusing hunks that are close to each other. |
| 231 | |
Junio C Hamano | 48fd2f6 | 2007-03-19 02:02:30 | [diff] [blame] | 232 | --exit-code:: |
| 233 | Make the program exit with codes similar to diff(1). |
| 234 | That is, it exits with 1 if there were differences and |
| 235 | 0 means no differences. |
| 236 | |
Junio C Hamano | 35e5755 | 2007-03-25 07:54:35 | [diff] [blame] | 237 | --quiet:: |
| 238 | Disable all output of the program. Implies --exit-code. |
| 239 | |
Junio C Hamano | bb0f404 | 2007-07-04 06:41:40 | [diff] [blame] | 240 | --ext-diff:: |
| 241 | Allow an external diff helper to be executed. If you set an |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 242 | external diff driver with linkgit:gitattributes[5], you need |
| 243 | to use this option with linkgit:git-log[1] and friends. |
Junio C Hamano | bb0f404 | 2007-07-04 06:41:40 | [diff] [blame] | 244 | |
| 245 | --no-ext-diff:: |
| 246 | Disallow external diff drivers. |
| 247 | |
Junio C Hamano | dfccbb0 | 2008-05-26 01:16:14 | [diff] [blame] | 248 | --ignore-submodules:: |
| 249 | Ignore changes to submodules in the diff generation. |
| 250 | |
Junio C Hamano | e27cbd2 | 2007-12-21 17:57:33 | [diff] [blame] | 251 | --src-prefix=<prefix>:: |
| 252 | Show the given source prefix instead of "a/". |
| 253 | |
| 254 | --dst-prefix=<prefix>:: |
| 255 | Show the given destination prefix instead of "b/". |
| 256 | |
| 257 | --no-prefix:: |
| 258 | Do not show any source or destination prefix. |
| 259 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 260 | For more detailed explanation on these common options, see also |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 261 | linkgit:gitdiffcore[7]. |