Git fork

Merge branch 'ja/git-diff-doc-markup'

Documentation mark-up updates.

* ja/git-diff-doc-markup:
doc: git-diff: apply format changes to config part
doc: git-diff: apply format changes to diff-generate-patch
doc: git-diff: apply format changes to diff-format
doc: git-diff: apply format changes to diff-options
doc: git-diff: apply new documentation guidelines

+432 -401
+110 -92
Documentation/config/diff.txt
··· 1 - diff.autoRefreshIndex:: 2 - When using 'git diff' to compare with work tree 1 + `diff.autoRefreshIndex`:: 2 + When using `git diff` to compare with work tree 3 3 files, do not consider stat-only changes as changed. 4 4 Instead, silently run `git update-index --refresh` to 5 5 update the cached stat information for paths whose 6 6 contents in the work tree match the contents in the 7 - index. This option defaults to true. Note that this 8 - affects only 'git diff' Porcelain, and not lower level 9 - 'diff' commands such as 'git diff-files'. 7 + index. This option defaults to `true`. Note that this 8 + affects only `git diff` Porcelain, and not lower level 9 + `diff` commands such as `git diff-files`. 10 10 11 - diff.dirstat:: 11 + `diff.dirstat`:: 12 + ifdef::git-diff[] 13 + A comma separated list of `--dirstat` parameters specifying the 14 + default behavior of the `--dirstat` option to `git diff` and friends. 15 + endif::git-diff[] 16 + ifndef::git-diff[] 12 17 A comma separated list of `--dirstat` parameters specifying the 13 18 default behavior of the `--dirstat` option to linkgit:git-diff[1] 14 - and friends. The defaults can be overridden on the command line 15 - (using `--dirstat=<param1,param2,...>`). The fallback defaults 19 + and friends. 20 + endif::git-diff[] 21 + The defaults can be overridden on the command line 22 + (using `--dirstat=<param>,...`). The fallback defaults 16 23 (when not changed by `diff.dirstat`) are `changes,noncumulative,3`. 17 24 The following parameters are available: 18 25 + ··· 41 48 Note that when using `cumulative`, the sum of the percentages 42 49 reported may exceed 100%. The default (non-cumulative) behavior can 43 50 be specified with the `noncumulative` parameter. 44 - <limit>;; 51 + _<limit>_;; 45 52 An integer parameter specifies a cut-off percent (3% by default). 46 53 Directories contributing less than this percentage of the changes 47 54 are not shown in the output. ··· 52 59 and accumulating child directory counts in the parent directories: 53 60 `files,10,cumulative`. 54 61 55 - diff.statNameWidth:: 56 - Limit the width of the filename part in --stat output. If set, applies 57 - to all commands generating --stat output except format-patch. 62 + `diff.statNameWidth`:: 63 + Limit the width of the filename part in `--stat` output. If set, applies 64 + to all commands generating `--stat` output except `format-patch`. 58 65 59 - diff.statGraphWidth:: 60 - Limit the width of the graph part in --stat output. If set, applies 61 - to all commands generating --stat output except format-patch. 66 + `diff.statGraphWidth`:: 67 + Limit the width of the graph part in `--stat` output. If set, applies 68 + to all commands generating `--stat` output except `format-patch`. 62 69 63 - diff.context:: 64 - Generate diffs with <n> lines of context instead of the default 65 - of 3. This value is overridden by the -U option. 70 + `diff.context`:: 71 + Generate diffs with _<n>_ lines of context instead of the default 72 + of 3. This value is overridden by the `-U` option. 66 73 67 - diff.interHunkContext:: 74 + `diff.interHunkContext`:: 68 75 Show the context between diff hunks, up to the specified number 69 76 of lines, thereby fusing the hunks that are close to each other. 70 77 This value serves as the default for the `--inter-hunk-context` 71 78 command line option. 72 79 73 - diff.external:: 80 + `diff.external`:: 74 81 If this config variable is set, diff generation is not 75 82 performed using the internal diff machinery, but using the 76 - given command. Can be overridden with the `GIT_EXTERNAL_DIFF' 83 + given command. Can be overridden with the `GIT_EXTERNAL_DIFF` 77 84 environment variable. The command is called with parameters 78 85 as described under "git Diffs" in linkgit:git[1]. Note: if 79 86 you want to use an external diff program only on a subset of 80 87 your files, you might want to use linkgit:gitattributes[5] instead. 81 88 82 - diff.trustExitCode:: 83 - If this boolean value is set to true then the 89 + `diff.trustExitCode`:: 90 + If this boolean value is set to `true` then the 84 91 `diff.external` command is expected to return exit code 85 92 0 if it considers the input files to be equal or 1 if it 86 - considers them to be different, like `diff(1)`. 87 - If it is set to false, which is the default, then the command 88 - is expected to return exit code 0 regardless of equality. 93 + considers them to be different, like `diff`(1). 94 + If it is set to `false`, which is the default, then the command 95 + is expected to return exit code `0` regardless of equality. 89 96 Any other exit code causes Git to report a fatal error. 90 97 91 - diff.ignoreSubmodules:: 92 - Sets the default value of --ignore-submodules. Note that this 93 - affects only 'git diff' Porcelain, and not lower level 'diff' 94 - commands such as 'git diff-files'. 'git checkout' 95 - and 'git switch' also honor 98 + `diff.ignoreSubmodules`:: 99 + Sets the default value of `--ignore-submodules`. Note that this 100 + affects only `git diff` Porcelain, and not lower level `diff` 101 + commands such as `git diff-files`. `git checkout` 102 + and `git switch` also honor 96 103 this setting when reporting uncommitted changes. Setting it to 97 - 'all' disables the submodule summary normally shown by 'git commit' 98 - and 'git status' when `status.submoduleSummary` is set unless it is 99 - overridden by using the --ignore-submodules command-line option. 100 - The 'git submodule' commands are not affected by this setting. 104 + `all` disables the submodule summary normally shown by `git commit` 105 + and `git status` when `status.submoduleSummary` is set unless it is 106 + overridden by using the `--ignore-submodules` command-line option. 107 + The `git submodule` commands are not affected by this setting. 101 108 By default this is set to untracked so that any untracked 102 109 submodules are ignored. 103 110 104 - diff.mnemonicPrefix:: 105 - If set, 'git diff' uses a prefix pair that is different from the 106 - standard "a/" and "b/" depending on what is being compared. When 111 + `diff.mnemonicPrefix`:: 112 + If set, `git diff` uses a prefix pair that is different from the 113 + standard `a/` and `b/` depending on what is being compared. When 107 114 this configuration is in effect, reverse diff output also swaps 108 115 the order of the prefixes: 109 116 `git diff`;; ··· 112 119 compares a (c)ommit and the (w)ork tree; 113 120 `git diff --cached`;; 114 121 compares a (c)ommit and the (i)ndex; 115 - `git diff HEAD:file1 file2`;; 122 + `git diff HEAD:<file1> <file2>`;; 116 123 compares an (o)bject and a (w)ork tree entity; 117 - `git diff --no-index a b`;; 118 - compares two non-git things (1) and (2). 124 + `git diff --no-index <a> <b>`;; 125 + compares two non-git things _<a>_ and _<b>_. 119 126 120 - diff.noPrefix:: 121 - If set, 'git diff' does not show any source or destination prefix. 127 + `diff.noPrefix`:: 128 + If set, `git diff` does not show any source or destination prefix. 122 129 123 - diff.srcPrefix:: 124 - If set, 'git diff' uses this source prefix. Defaults to "a/". 130 + `diff.srcPrefix`:: 131 + If set, `git diff` uses this source prefix. Defaults to `a/`. 125 132 126 - diff.dstPrefix:: 127 - If set, 'git diff' uses this destination prefix. Defaults to "b/". 133 + `diff.dstPrefix`:: 134 + If set, `git diff` uses this destination prefix. Defaults to `b/`. 128 135 129 - diff.relative:: 130 - If set to 'true', 'git diff' does not show changes outside of the directory 136 + `diff.relative`:: 137 + If set to `true`, `git diff` does not show changes outside of the directory 131 138 and show pathnames relative to the current directory. 132 139 133 - diff.orderFile:: 140 + `diff.orderFile`:: 134 141 File indicating how to order files within a diff. 135 - See the '-O' option to linkgit:git-diff[1] for details. 142 + ifdef::git-diff[] 143 + See the `-O` option for details. 144 + endif::git-diff[] 145 + ifndef::git-diff[] 146 + See the `-O` option to linkgit:git-diff[1] for details. 147 + endif::git-diff[] 136 148 If `diff.orderFile` is a relative pathname, it is treated as 137 149 relative to the top of the working tree. 138 150 139 - diff.renameLimit:: 151 + `diff.renameLimit`:: 140 152 The number of files to consider in the exhaustive portion of 141 - copy/rename detection; equivalent to the 'git diff' option 153 + copy/rename detection; equivalent to the `git diff` option 142 154 `-l`. If not set, the default value is currently 1000. This 143 155 setting has no effect if rename detection is turned off. 144 156 145 - diff.renames:: 146 - Whether and how Git detects renames. If set to "false", 147 - rename detection is disabled. If set to "true", basic rename 148 - detection is enabled. If set to "copies" or "copy", Git will 149 - detect copies, as well. Defaults to true. Note that this 150 - affects only 'git diff' Porcelain like linkgit:git-diff[1] and 157 + `diff.renames`:: 158 + Whether and how Git detects renames. If set to `false`, 159 + rename detection is disabled. If set to `true`, basic rename 160 + detection is enabled. If set to `copies` or `copy`, Git will 161 + detect copies, as well. Defaults to `true`. Note that this 162 + affects only `git diff` Porcelain like linkgit:git-diff[1] and 151 163 linkgit:git-log[1], and not lower level commands such as 152 164 linkgit:git-diff-files[1]. 153 165 154 - diff.suppressBlankEmpty:: 166 + `diff.suppressBlankEmpty`:: 155 167 A boolean to inhibit the standard behavior of printing a space 156 - before each empty output line. Defaults to false. 168 + before each empty output line. Defaults to `false`. 157 169 158 - diff.submodule:: 170 + `diff.submodule`:: 159 171 Specify the format in which differences in submodules are 160 - shown. The "short" format just shows the names of the commits 161 - at the beginning and end of the range. The "log" format lists 172 + shown. The `short` format just shows the names of the commits 173 + at the beginning and end of the range. The `log` format lists 162 174 the commits in the range like linkgit:git-submodule[1] `summary` 163 - does. The "diff" format shows an inline diff of the changed 164 - contents of the submodule. Defaults to "short". 175 + does. The `diff` format shows an inline diff of the changed 176 + contents of the submodule. Defaults to `short`. 165 177 166 - diff.wordRegex:: 178 + `diff.wordRegex`:: 167 179 A POSIX Extended Regular Expression used to determine what is a "word" 168 180 when performing word-by-word difference calculations. Character 169 181 sequences that match the regular expression are "words", all other 170 182 characters are *ignorable* whitespace. 171 183 172 - diff.<driver>.command:: 184 + `diff.<driver>.command`:: 173 185 The custom diff driver command. See linkgit:gitattributes[5] 174 186 for details. 175 187 176 - diff.<driver>.trustExitCode:: 177 - If this boolean value is set to true then the 188 + `diff.<driver>.trustExitCode`:: 189 + If this boolean value is set to `true` then the 178 190 `diff.<driver>.command` command is expected to return exit code 179 191 0 if it considers the input files to be equal or 1 if it 180 - considers them to be different, like `diff(1)`. 181 - If it is set to false, which is the default, then the command 192 + considers them to be different, like `diff`(1). 193 + If it is set to `false`, which is the default, then the command 182 194 is expected to return exit code 0 regardless of equality. 183 195 Any other exit code causes Git to report a fatal error. 184 196 185 - diff.<driver>.xfuncname:: 197 + `diff.<driver>.xfuncname`:: 186 198 The regular expression that the diff driver should use to 187 199 recognize the hunk header. A built-in pattern may also be used. 188 200 See linkgit:gitattributes[5] for details. 189 201 190 - diff.<driver>.binary:: 191 - Set this option to true to make the diff driver treat files as 202 + `diff.<driver>.binary`:: 203 + Set this option to `true` to make the diff driver treat files as 192 204 binary. See linkgit:gitattributes[5] for details. 193 205 194 - diff.<driver>.textconv:: 206 + `diff.<driver>.textconv`:: 195 207 The command that the diff driver should call to generate the 196 208 text-converted version of a file. The result of the 197 209 conversion is used to generate a human-readable diff. See 198 210 linkgit:gitattributes[5] for details. 199 211 200 - diff.<driver>.wordRegex:: 212 + `diff.<driver>.wordRegex`:: 201 213 The regular expression that the diff driver should use to 202 214 split words in a line. See linkgit:gitattributes[5] for 203 215 details. 204 216 205 - diff.<driver>.cachetextconv:: 206 - Set this option to true to make the diff driver cache the text 217 + `diff.<driver>.cachetextconv`:: 218 + Set this option to `true` to make the diff driver cache the text 207 219 conversion outputs. See linkgit:gitattributes[5] for details. 208 220 209 221 include::../mergetools-diff.txt[] 210 222 211 - diff.indentHeuristic:: 223 + `diff.indentHeuristic`:: 212 224 Set this option to `false` to disable the default heuristics 213 225 that shift diff hunk boundaries to make patches easier to read. 214 226 215 - diff.algorithm:: 227 + `diff.algorithm`:: 216 228 Choose a diff algorithm. The variants are as follows: 217 229 + 218 230 -- 219 - `default`, `myers`;; 231 + `default`;; 232 + `myers`;; 220 233 The basic greedy diff algorithm. Currently, this is the default. 221 234 `minimal`;; 222 235 Spend extra time to make sure the smallest possible diff is ··· 229 242 -- 230 243 + 231 244 232 - diff.wsErrorHighlight:: 245 + `diff.wsErrorHighlight`:: 233 246 Highlight whitespace errors in the `context`, `old` or `new` 234 247 lines of the diff. Multiple values are separated by comma, 235 248 `none` resets previous values, `default` reset the list to ··· 238 251 The command line option `--ws-error-highlight=<kind>` 239 252 overrides this setting. 240 253 241 - diff.colorMoved:: 242 - If set to either a valid `<mode>` or a true value, moved lines 243 - in a diff are colored differently, for details of valid modes 244 - see '--color-moved' in linkgit:git-diff[1]. If simply set to 245 - true the default color mode will be used. When set to false, 246 - moved lines are not colored. 254 + `diff.colorMoved`:: 255 + If set to either a valid _<mode>_ or a `true` value, moved lines 256 + in a diff are colored differently. 257 + ifdef::git-diff[] 258 + For details of valid modes see `--color-moved`. 259 + endif::git-diff[] 260 + ifndef::git-diff[] 261 + For details of valid modes see `--color-moved` in linkgit:git-diff[1]. 262 + endif::git-diff[] 263 + If simply set to `true` the default color mode will be used. When 264 + set to `false`, moved lines are not colored. 247 265 248 - diff.colorMovedWS:: 266 + `diff.colorMovedWS`:: 249 267 When moved lines are colored using e.g. the `diff.colorMoved` setting, 250 - this option controls the `<mode>` how spaces are treated. 251 - For details of valid modes see '--color-moved-ws' in linkgit:git-diff[1]. 268 + this option controls the mode how spaces are treated. 269 + For details of valid modes see `--color-moved-ws` in linkgit:git-diff[1].
+21 -21
Documentation/diff-format.txt
··· 1 1 Raw output format 2 2 ----------------- 3 3 4 - The raw output format from "git-diff-index", "git-diff-tree", 5 - "git-diff-files" and "git diff --raw" are very similar. 4 + The raw output format from `git-diff-index`, `git-diff-tree`, 5 + `git-diff-files` and `git diff --raw` are very similar. 6 6 7 7 These commands all compare two sets of things; what is 8 8 compared differs: 9 9 10 - git-diff-index <tree-ish>:: 11 - compares the <tree-ish> and the files on the filesystem. 10 + `git-diff-index <tree-ish>`:: 11 + compares the _<tree-ish>_ and the files on the filesystem. 12 12 13 - git-diff-index --cached <tree-ish>:: 14 - compares the <tree-ish> and the index. 13 + `git-diff-index --cached <tree-ish>`:: 14 + compares the _<tree-ish>_ and the index. 15 15 16 - git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>...]:: 16 + `git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>...]`:: 17 17 compares the trees named by the two arguments. 18 18 19 - git-diff-files [<pattern>...]:: 19 + `git-diff-files [<pattern>...]`:: 20 20 compares the index and the files on the filesystem. 21 21 22 - The "git-diff-tree" command begins its output by printing the hash of 22 + The `git-diff-tree` command begins its output by printing the hash of 23 23 what is being compared. After that, all the commands print one output 24 24 line per changed file. 25 25 ··· 54 54 55 55 Possible status letters are: 56 56 57 - - A: addition of a file 58 - - C: copy of a file into a new one 59 - - D: deletion of a file 60 - - M: modification of the contents or mode of a file 61 - - R: renaming of a file 62 - - T: change in the type of the file (regular file, symbolic link or submodule) 63 - - U: file is unmerged (you must complete the merge before it can 57 + - `A`: addition of a file 58 + - `C`: copy of a file into a new one 59 + - `D`: deletion of a file 60 + - `M`: modification of the contents or mode of a file 61 + - `R`: renaming of a file 62 + - `T`: change in the type of the file (regular file, symbolic link or submodule) 63 + - `U`: file is unmerged (you must complete the merge before it can 64 64 be committed) 65 - - X: "unknown" change type (most probably a bug, please report it) 65 + - `X`: "unknown" change type (most probably a bug, please report it) 66 66 67 - Status letters C and R are always followed by a score (denoting the 67 + Status letters `C` and `R` are always followed by a score (denoting the 68 68 percentage of similarity between the source and target of the move or 69 - copy). Status letter M may be followed by a score (denoting the 69 + copy). Status letter `M` may be followed by a score (denoting the 70 70 percentage of dissimilarity) for file rewrites. 71 71 72 72 The sha1 for "dst" is shown as all 0's if a file on the filesystem ··· 86 86 diff format for merges 87 87 ---------------------- 88 88 89 - "git-diff-tree", "git-diff-files" and "git-diff --raw" 89 + `git-diff-tree`, `git-diff-files` and `git-diff --raw` 90 90 can take `-c` or `--cc` option 91 91 to generate diff output also for merge commits. The output differs 92 92 from the format described above in the following way: ··· 128 128 ------------------ 129 129 130 130 The `--summary` option describes newly added, deleted, renamed and 131 - copied files. The `--stat` option adds diffstat(1) graph to the 131 + copied files. The `--stat` option adds `diffstat`(1) graph to the 132 132 output. These options can be combined with other options, such as 133 133 `-p`, and are meant for human consumption. 134 134
+23 -21
Documentation/diff-generate-patch.txt
··· 14 14 `GIT_EXTERNAL_DIFF` and the `GIT_DIFF_OPTS` environment variables 15 15 (see linkgit:git[1]), and the `diff` attribute (see linkgit:gitattributes[5]). 16 16 17 - What the -p option produces is slightly different from the traditional 17 + What the `-p` option produces is slightly different from the traditional 18 18 diff format: 19 19 20 20 1. It is preceded by a "git diff" header that looks like this: ··· 30 30 the file that the rename/copy produces, respectively. 31 31 32 32 2. It is followed by one or more extended header lines: 33 - 34 - old mode <mode> 35 - new mode <mode> 36 - deleted file mode <mode> 37 - new file mode <mode> 38 - copy from <path> 39 - copy to <path> 40 - rename from <path> 41 - rename to <path> 42 - similarity index <number> 43 - dissimilarity index <number> 44 - index <hash>..<hash> <mode> 33 + + 34 + [synopsis] 35 + old mode <mode> 36 + new mode <mode> 37 + deleted file mode <mode> 38 + new file mode <mode> 39 + copy from <path> 40 + copy to <path> 41 + rename from <path> 42 + rename to <path> 43 + similarity index <number> 44 + dissimilarity index <number> 45 + index <hash>..<hash> <mode> 45 46 + 46 - File modes are printed as 6-digit octal numbers including the file type 47 + File modes _<mode>_ are printed as 6-digit octal numbers including the file type 47 48 and file permission bits. 48 49 + 49 50 Path names in extended headers do not include the `a/` and `b/` prefixes. ··· 56 57 file made it into the new one. 57 58 + 58 59 The index line includes the blob object names before and after the change. 59 - The <mode> is included if the file mode does not change; otherwise, 60 + The _<mode>_ is included if the file mode does not change; otherwise, 60 61 separate lines indicate the old and the new mode. 61 62 62 63 3. Pathnames with "unusual" characters are quoted as explained for ··· 134 135 135 136 2. It is followed by one or more extended header lines 136 137 (this example shows a merge with two parents): 137 - 138 - index <hash>,<hash>..<hash> 139 - mode <mode>,<mode>..<mode> 140 - new file mode <mode> 141 - deleted file mode <mode>,<mode> 138 + + 139 + [synopsis] 140 + index <hash>,<hash>..<hash> 141 + mode <mode>,<mode>`..`<mode> 142 + new file mode <mode> 143 + deleted file mode <mode>,<mode> 142 144 + 143 145 The `mode <mode>,<mode>..<mode>` line appears only if at least one of 144 146 the <mode> is different from the rest. Extended headers with 145 147 information about detected content movement (renames and 146 148 copying detection) are designed to work with the diff of two 147 - <tree-ish> and are not used by combined diff format. 149 + _<tree-ish>_ and are not used by combined diff format. 148 150 149 151 3. It is followed by a two-line from-file/to-file header: 150 152
+212 -211
Documentation/diff-options.txt
··· 19 19 endif::git-format-patch[] 20 20 21 21 ifndef::git-format-patch[] 22 - -p:: 23 - -u:: 24 - --patch:: 22 + `-p`:: 23 + `-u`:: 24 + `--patch`:: 25 25 Generate patch (see <<generate_patch_text_with_p>>). 26 26 ifdef::git-diff[] 27 27 This is the default. 28 28 endif::git-diff[] 29 29 30 - -s:: 31 - --no-patch:: 30 + `-s`:: 31 + `--no-patch`:: 32 32 Suppress all output from the diff machinery. Useful for 33 33 commands like `git show` that show the patch by default to 34 34 squelch their output, or to cancel the effect of options like ··· 39 39 ifdef::git-log[] 40 40 -m:: 41 41 Show diffs for merge commits in the default format. This is 42 - similar to '--diff-merges=on', except `-m` will 42 + similar to `--diff-merges=on`, except `-m` will 43 43 produce no output unless `-p` is given as well. 44 44 45 45 -c:: 46 46 Produce combined diff output for merge commits. 47 - Shortcut for '--diff-merges=combined -p'. 47 + Shortcut for `--diff-merges=combined -p`. 48 48 49 49 --cc:: 50 50 Produce dense combined diff output for merge commits. 51 - Shortcut for '--diff-merges=dense-combined -p'. 51 + Shortcut for `--diff-merges=dense-combined -p`. 52 52 53 53 --dd:: 54 54 Produce diff with respect to first parent for both merge and 55 55 regular commits. 56 - Shortcut for '--diff-merges=first-parent -p'. 56 + Shortcut for `--diff-merges=first-parent -p`. 57 57 58 58 --remerge-diff:: 59 59 Produce remerge-diff output for merge commits. 60 - Shortcut for '--diff-merges=remerge -p'. 60 + Shortcut for `--diff-merges=remerge -p`. 61 61 62 62 --no-diff-merges:: 63 - Synonym for '--diff-merges=off'. 63 + Synonym for `--diff-merges=off`. 64 64 65 65 --diff-merges=<format>:: 66 66 Specify diff format to be used for merge commits. Default is ··· 73 73 off, none:: 74 74 Disable output of diffs for merge commits. Useful to override 75 75 implied value. 76 - + 76 + 77 77 on, m:: 78 78 Make diff output for merge commits to be shown in the default 79 79 format. The default format can be changed using 80 80 `log.diffMerges` configuration variable, whose default value 81 81 is `separate`. 82 - + 82 + 83 83 first-parent, 1:: 84 84 Show full diff with respect to first parent. This is the same 85 85 format as `--patch` produces for non-merge commits. 86 - + 86 + 87 87 separate:: 88 88 Show full diff with respect to each of parents. 89 89 Separate log entry and diff is generated for each parent. 90 - + 90 + 91 91 combined, c:: 92 92 Show differences from each of the parents to the merge 93 93 result simultaneously instead of showing pairwise diff between 94 94 a parent and the result one at a time. Furthermore, it lists 95 95 only files which were modified from all parents. 96 - + 96 + 97 97 dense-combined, cc:: 98 98 Further compress output produced by `--diff-merges=combined` 99 99 by omitting uninteresting hunks whose contents in the parents 100 100 have only two variants and the merge result picks one of them 101 101 without modification. 102 - + 102 + 103 103 remerge, r:: 104 104 Remerge two-parent merge commits to create a temporary tree 105 105 object--potentially containing files with conflict markers ··· 112 112 -- 113 113 114 114 --combined-all-paths:: 115 - This flag causes combined diffs (used for merge commits) to 115 + Cause combined diffs (used for merge commits) to 116 116 list the name of the file from all parents. It thus only has 117 117 effect when `--diff-merges=[dense-]combined` is in use, and 118 118 is likely only useful if filename changes are detected (i.e. 119 119 when either rename or copy detection have been requested). 120 120 endif::git-log[] 121 121 122 - -U<n>:: 123 - --unified=<n>:: 124 - Generate diffs with <n> lines of context instead of 122 + `-U<n>`:: 123 + `--unified=<n>`:: 124 + Generate diffs with _<n>_ lines of context instead of 125 125 the usual three. 126 126 ifndef::git-format-patch[] 127 127 Implies `--patch`. 128 128 endif::git-format-patch[] 129 129 130 - --output=<file>:: 130 + `--output=<file>`:: 131 131 Output to a specific file instead of stdout. 132 132 133 - --output-indicator-new=<char>:: 134 - --output-indicator-old=<char>:: 135 - --output-indicator-context=<char>:: 133 + `--output-indicator-new=<char>`:: 134 + `--output-indicator-old=<char>`:: 135 + `--output-indicator-context=<char>`:: 136 136 Specify the character used to indicate new, old or context 137 - lines in the generated patch. Normally they are '+', '-' and 137 + lines in the generated patch. Normally they are `+`, `-` and 138 138 ' ' respectively. 139 139 140 140 ifndef::git-format-patch[] 141 - --raw:: 141 + `--raw`:: 142 142 ifndef::git-log[] 143 143 Generate the diff in raw format. 144 144 ifdef::git-diff-core[] ··· 155 155 endif::git-format-patch[] 156 156 157 157 ifndef::git-format-patch[] 158 - --patch-with-raw:: 158 + `--patch-with-raw`:: 159 159 Synonym for `-p --raw`. 160 160 endif::git-format-patch[] 161 161 162 162 ifdef::git-log[] 163 - -t:: 163 + `-t`:: 164 164 Show the tree objects in the diff output. 165 165 endif::git-log[] 166 166 167 - --indent-heuristic:: 167 + `--indent-heuristic`:: 168 168 Enable the heuristic that shifts diff hunk boundaries to make patches 169 169 easier to read. This is the default. 170 170 171 - --no-indent-heuristic:: 171 + `--no-indent-heuristic`:: 172 172 Disable the indent heuristic. 173 173 174 - --minimal:: 174 + `--minimal`:: 175 175 Spend extra time to make sure the smallest possible 176 176 diff is produced. 177 177 178 - --patience:: 178 + `--patience`:: 179 179 Generate a diff using the "patience diff" algorithm. 180 180 181 - --histogram:: 181 + `--histogram`:: 182 182 Generate a diff using the "histogram diff" algorithm. 183 183 184 - --anchored=<text>:: 184 + `--anchored=<text>`:: 185 185 Generate a diff using the "anchored diff" algorithm. 186 186 + 187 187 This option may be specified more than once. 188 188 + 189 189 If a line exists in both the source and destination, exists only once, 190 - and starts with this text, this algorithm attempts to prevent it from 190 + and starts with _<text>_, this algorithm attempts to prevent it from 191 191 appearing as a deletion or addition in the output. It uses the "patience 192 192 diff" algorithm internally. 193 193 194 - --diff-algorithm={patience|minimal|histogram|myers}:: 194 + `--diff-algorithm=(patience|minimal|histogram|myers)`:: 195 195 Choose a diff algorithm. The variants are as follows: 196 196 + 197 197 -- 198 - `default`, `myers`;; 198 + `default`;; 199 + `myers`;; 199 200 The basic greedy diff algorithm. Currently, this is the default. 200 - `minimal`;; 201 + `minimal`;; 201 202 Spend extra time to make sure the smallest possible diff is 202 203 produced. 203 - `patience`;; 204 + `patience`;; 204 205 Use "patience diff" algorithm when generating patches. 205 - `histogram`;; 206 + `histogram`;; 206 207 This algorithm extends the patience algorithm to "support 207 208 low-occurrence common elements". 208 209 -- ··· 211 212 non-default value and want to use the default one, then you 212 213 have to use `--diff-algorithm=default` option. 213 214 214 - --stat[=<width>[,<name-width>[,<count>]]]:: 215 + `--stat[=<width>[,<name-width>[,<count>]]]`:: 215 216 Generate a diffstat. By default, as much space as necessary 216 217 will be used for the filename part, and the rest for the graph 217 218 part. Maximum width defaults to terminal width, or 80 columns 218 219 if not connected to a terminal, and can be overridden by 219 - `<width>`. The width of the filename part can be limited by 220 - giving another width `<name-width>` after a comma or by setting 221 - `diff.statNameWidth=<width>`. The width of the graph part can be 222 - limited by using `--stat-graph-width=<width>` or by setting 223 - `diff.statGraphWidth=<width>`. Using `--stat` or 220 + _<width>_. The width of the filename part can be limited by 221 + giving another width _<name-width>_ after a comma or by setting 222 + `diff.statNameWidth=<name-width>`. The width of the graph part can be 223 + limited by using `--stat-graph-width=<graph-width>` or by setting 224 + `diff.statGraphWidth=<graph-width>`. Using `--stat` or 224 225 `--stat-graph-width` affects all commands generating a stat graph, 225 226 while setting `diff.statNameWidth` or `diff.statGraphWidth` 226 227 does not affect `git format-patch`. 227 - By giving a third parameter `<count>`, you can limit the output to 228 - the first `<count>` lines, followed by `...` if there are more. 228 + By giving a third parameter _<count>_, you can limit the output to 229 + the first _<count>_ lines, followed by `...` if there are more. 229 230 + 230 231 These parameters can also be set individually with `--stat-width=<width>`, 231 232 `--stat-name-width=<name-width>` and `--stat-count=<count>`. 232 233 233 - --compact-summary:: 234 + `--compact-summary`:: 234 235 Output a condensed summary of extended header information such 235 - as file creations or deletions ("new" or "gone", optionally "+l" 236 - if it's a symlink) and mode changes ("+x" or "-x" for adding 236 + as file creations or deletions ("new" or "gone", optionally `+l` 237 + if it's a symlink) and mode changes (`+x` or `-x` for adding 237 238 or removing executable bit respectively) in diffstat. The 238 239 information is put between the filename part and the graph 239 240 part. Implies `--stat`. 240 241 241 - --numstat:: 242 + `--numstat`:: 242 243 Similar to `--stat`, but shows number of added and 243 244 deleted lines in decimal notation and pathname without 244 245 abbreviation, to make it more machine friendly. For 245 246 binary files, outputs two `-` instead of saying 246 247 `0 0`. 247 248 248 - --shortstat:: 249 + `--shortstat`:: 249 250 Output only the last line of the `--stat` format containing total 250 251 number of modified files, as well as number of added and deleted 251 252 lines. 252 253 253 - -X[<param1,param2,...>]:: 254 - --dirstat[=<param1,param2,...>]:: 254 + `-X [<param>,...]`:: 255 + `--dirstat[=<param>,...]`:: 255 256 Output the distribution of relative amount of changes for each 256 257 sub-directory. The behavior of `--dirstat` can be customized by 257 258 passing it a comma separated list of parameters. ··· 284 285 Note that when using `cumulative`, the sum of the percentages 285 286 reported may exceed 100%. The default (non-cumulative) behavior can 286 287 be specified with the `noncumulative` parameter. 287 - <limit>;; 288 + _<limit>_;; 288 289 An integer parameter specifies a cut-off percent (3% by default). 289 290 Directories contributing less than this percentage of the changes 290 291 are not shown in the output. ··· 295 296 and accumulating child directory counts in the parent directories: 296 297 `--dirstat=files,10,cumulative`. 297 298 298 - --cumulative:: 299 - Synonym for --dirstat=cumulative 299 + `--cumulative`:: 300 + Synonym for `--dirstat=cumulative`. 300 301 301 - --dirstat-by-file[=<param1,param2>...]:: 302 - Synonym for --dirstat=files,<param1>,<param2>... 302 + `--dirstat-by-file[=<param>,...]`:: 303 + Synonym for `--dirstat=files,<param>,...`. 303 304 304 - --summary:: 305 + `--summary`:: 305 306 Output a condensed summary of extended header information 306 307 such as creations, renames and mode changes. 307 308 308 309 ifndef::git-format-patch[] 309 - --patch-with-stat:: 310 + `--patch-with-stat`:: 310 311 Synonym for `-p --stat`. 311 312 endif::git-format-patch[] 312 313 313 314 ifndef::git-format-patch[] 314 315 315 - -z:: 316 + `-z`:: 316 317 ifdef::git-log[] 317 - Separate the commits with NULs instead of newlines. 318 + Separate the commits with __NUL__s instead of newlines. 318 319 + 319 320 Also, when `--raw` or `--numstat` has been given, do not munge 320 - pathnames and use NULs as output field terminators. 321 + pathnames and use __NUL__s as output field terminators. 321 322 endif::git-log[] 322 323 ifndef::git-log[] 323 324 When `--raw`, `--numstat`, `--name-only` or `--name-status` has been ··· 328 329 explained for the configuration variable `core.quotePath` (see 329 330 linkgit:git-config[1]). 330 331 331 - --name-only:: 332 + `--name-only`:: 332 333 Show only the name of each changed file in the post-image tree. 333 334 The file names are often encoded in UTF-8. 334 335 For more information see the discussion about encoding in the linkgit:git-log[1] 335 336 manual page. 336 337 337 - --name-status:: 338 + `--name-status`:: 338 339 Show only the name(s) and status of each changed file. See the description 339 340 of the `--diff-filter` option on what the status letters mean. 340 341 Just like `--name-only` the file names are often encoded in UTF-8. 341 342 342 - --submodule[=<format>]:: 343 + `--submodule[=<format>]`:: 343 344 Specify how differences in submodules are shown. When specifying 344 - `--submodule=short` the 'short' format is used. This format just 345 + `--submodule=short` the `short` format is used. This format just 345 346 shows the names of the commits at the beginning and end of the range. 346 - When `--submodule` or `--submodule=log` is specified, the 'log' 347 + When `--submodule` or `--submodule=log` is specified, the `log` 347 348 format is used. This format lists the commits in the range like 348 349 linkgit:git-submodule[1] `summary` does. When `--submodule=diff` 349 - is specified, the 'diff' format is used. This format shows an 350 + is specified, the `diff` format is used. This format shows an 350 351 inline diff of the changes in the submodule contents between the 351 - commit range. Defaults to `diff.submodule` or the 'short' format 352 + commit range. Defaults to `diff.submodule` or the `short` format 352 353 if the config option is unset. 353 354 354 - --color[=<when>]:: 355 + `--color[=<when>]`:: 355 356 Show colored diff. 356 - `--color` (i.e. without '=<when>') is the same as `--color=always`. 357 - '<when>' can be one of `always`, `never`, or `auto`. 357 + `--color` (i.e. without `=<when>`) is the same as `--color=always`. 358 + _<when>_ can be one of `always`, `never`, or `auto`. 358 359 ifdef::git-diff[] 359 360 It can be changed by the `color.ui` and `color.diff` 360 361 configuration settings. 361 362 endif::git-diff[] 362 363 363 - --no-color:: 364 + `--no-color`:: 364 365 Turn off colored diff. 365 366 ifdef::git-diff[] 366 367 This can be used to override configuration settings. 367 368 endif::git-diff[] 368 369 It is the same as `--color=never`. 369 370 370 - --color-moved[=<mode>]:: 371 + `--color-moved[=<mode>]`:: 371 372 Moved lines of code are colored differently. 372 373 ifdef::git-diff[] 373 374 It can be changed by the `diff.colorMoved` configuration setting. 374 375 endif::git-diff[] 375 - The <mode> defaults to 'no' if the option is not given 376 - and to 'zebra' if the option with no mode is given. 376 + The _<mode>_ defaults to `no` if the option is not given 377 + and to `zebra` if the option with no mode is given. 377 378 The mode must be one of: 378 379 + 379 380 -- 380 - no:: 381 + `no`:: 381 382 Moved lines are not highlighted. 382 - default:: 383 + `default`:: 383 384 Is a synonym for `zebra`. This may change to a more sensible mode 384 385 in the future. 385 - plain:: 386 + `plain`:: 386 387 Any line that is added in one location and was removed 387 - in another location will be colored with 'color.diff.newMoved'. 388 - Similarly 'color.diff.oldMoved' will be used for removed lines 388 + in another location will be colored with `color.diff.newMoved`. 389 + Similarly `color.diff.oldMoved` will be used for removed lines 389 390 that are added somewhere else in the diff. This mode picks up any 390 391 moved line, but it is not very useful in a review to determine 391 392 if a block of code was moved without permutation. 392 - blocks:: 393 + `blocks`:: 393 394 Blocks of moved text of at least 20 alphanumeric characters 394 395 are detected greedily. The detected blocks are 395 - painted using either the 'color.diff.{old,new}Moved' color. 396 + painted using either the `color.diff.(old|new)Moved` color. 396 397 Adjacent blocks cannot be told apart. 397 - zebra:: 398 - Blocks of moved text are detected as in 'blocks' mode. The blocks 399 - are painted using either the 'color.diff.{old,new}Moved' color or 400 - 'color.diff.{old,new}MovedAlternative'. The change between 398 + `zebra`:: 399 + Blocks of moved text are detected as in `blocks` mode. The blocks 400 + are painted using either the `color.diff.(old|new)Moved` color or 401 + `color.diff.(old|new)MovedAlternative`. The change between 401 402 the two colors indicates that a new block was detected. 402 - dimmed-zebra:: 403 - Similar to 'zebra', but additional dimming of uninteresting parts 403 + `dimmed-zebra`:: 404 + Similar to `zebra`, but additional dimming of uninteresting parts 404 405 of moved code is performed. The bordering lines of two adjacent 405 406 blocks are considered interesting, the rest is uninteresting. 406 407 `dimmed_zebra` is a deprecated synonym. 407 408 -- 408 409 409 - --no-color-moved:: 410 + `--no-color-moved`:: 410 411 Turn off move detection. This can be used to override configuration 411 412 settings. It is the same as `--color-moved=no`. 412 413 413 - --color-moved-ws=<modes>:: 414 + `--color-moved-ws=<mode>,...`:: 414 415 This configures how whitespace is ignored when performing the 415 416 move detection for `--color-moved`. 416 417 ifdef::git-diff[] ··· 419 420 These modes can be given as a comma separated list: 420 421 + 421 422 -- 422 - no:: 423 + `no`:: 423 424 Do not ignore whitespace when performing move detection. 424 - ignore-space-at-eol:: 425 + `ignore-space-at-eol`:: 425 426 Ignore changes in whitespace at EOL. 426 - ignore-space-change:: 427 + `ignore-space-change`:: 427 428 Ignore changes in amount of whitespace. This ignores whitespace 428 429 at line end, and considers all other sequences of one or 429 430 more whitespace characters to be equivalent. 430 - ignore-all-space:: 431 + `ignore-all-space`:: 431 432 Ignore whitespace when comparing lines. This ignores differences 432 433 even if one line has whitespace where the other line has none. 433 - allow-indentation-change:: 434 + `allow-indentation-change`:: 434 435 Initially ignore any whitespace in the move detection, then 435 436 group the moved code blocks only into a block if the change in 436 437 whitespace is the same per line. This is incompatible with the 437 438 other modes. 438 439 -- 439 440 440 - --no-color-moved-ws:: 441 + `--no-color-moved-ws`:: 441 442 Do not ignore whitespace when performing move detection. This can be 442 443 used to override configuration settings. It is the same as 443 444 `--color-moved-ws=no`. 444 445 445 - --word-diff[=<mode>]:: 446 - Show a word diff, using the <mode> to delimit changed words. 446 + `--word-diff[=<mode>]`:: 447 447 By default, words are delimited by whitespace; see 448 - `--word-diff-regex` below. The <mode> defaults to 'plain', and 448 + `--word-diff-regex` below. The _<mode>_ defaults to `plain`, and 449 449 must be one of: 450 450 + 451 451 -- 452 - color:: 452 + `color`:: 453 453 Highlight changed words using only colors. Implies `--color`. 454 - plain:: 455 - Show words as `[-removed-]` and `{+added+}`. Makes no 454 + `plain`:: 455 + Show words as ++[-removed-]++ and ++{+added+}++. Makes no 456 456 attempts to escape the delimiters if they appear in the input, 457 457 so the output may be ambiguous. 458 - porcelain:: 458 + `porcelain`:: 459 459 Use a special line-based format intended for script 460 460 consumption. Added/removed/unchanged runs are printed in the 461 461 usual unified diff format, starting with a `+`/`-`/` ` 462 462 character at the beginning of the line and extending to the 463 463 end of the line. Newlines in the input are represented by a 464 464 tilde `~` on a line of its own. 465 - none:: 465 + `none`:: 466 466 Disable word diff again. 467 467 -- 468 468 + 469 469 Note that despite the name of the first mode, color is used to 470 470 highlight the changed parts in all modes if enabled. 471 471 472 - --word-diff-regex=<regex>:: 473 - Use <regex> to decide what a word is, instead of considering 472 + `--word-diff-regex=<regex>`:: 473 + Use _<regex>_ to decide what a word is, instead of considering 474 474 runs of non-whitespace to be a word. Also implies 475 475 `--word-diff` unless it was already enabled. 476 476 + 477 477 Every non-overlapping match of the 478 - <regex> is considered a word. Anything between these matches is 478 + _<regex>_ is considered a word. Anything between these matches is 479 479 considered whitespace and ignored(!) for the purposes of finding 480 480 differences. You may want to append `|[^[:space:]]` to your regular 481 481 expression to make sure that it matches all non-whitespace characters. ··· 490 490 overrides any diff driver or configuration setting. Diff drivers 491 491 override configuration settings. 492 492 493 - --color-words[=<regex>]:: 493 + `--color-words[=<regex>]`:: 494 494 Equivalent to `--word-diff=color` plus (if a regex was 495 495 specified) `--word-diff-regex=<regex>`. 496 496 endif::git-format-patch[] 497 497 498 - --no-renames:: 498 + `--no-renames`:: 499 499 Turn off rename detection, even when the configuration 500 500 file gives the default to do so. 501 501 502 - --[no-]rename-empty:: 502 + `--[no-]rename-empty`:: 503 503 Whether to use empty blobs as rename source. 504 504 505 505 ifndef::git-format-patch[] 506 - --check:: 506 + `--check`:: 507 507 Warn if changes introduce conflict markers or whitespace errors. 508 508 What are considered whitespace errors is controlled by `core.whitespace` 509 509 configuration. By default, trailing whitespaces (including ··· 511 511 that is immediately followed by a tab character inside the 512 512 initial indent of the line are considered whitespace errors. 513 513 Exits with non-zero status if problems are found. Not compatible 514 - with --exit-code. 514 + with `--exit-code`. 515 515 516 - --ws-error-highlight=<kind>:: 516 + `--ws-error-highlight=<kind>`:: 517 517 Highlight whitespace errors in the `context`, `old` or `new` 518 518 lines of the diff. Multiple values are separated by comma, 519 519 `none` resets previous values, `default` reset the list to ··· 525 525 526 526 endif::git-format-patch[] 527 527 528 - --full-index:: 528 + `--full-index`:: 529 529 Instead of the first handful of characters, show the full 530 530 pre- and post-image blob object names on the "index" 531 531 line when generating patch format output. 532 532 533 - --binary:: 533 + `--binary`:: 534 534 In addition to `--full-index`, output a binary diff that 535 535 can be applied with `git-apply`. 536 536 ifndef::git-format-patch[] 537 537 Implies `--patch`. 538 538 endif::git-format-patch[] 539 539 540 - --abbrev[=<n>]:: 540 + `--abbrev[=<n>]`:: 541 541 Instead of showing the full 40-byte hexadecimal object 542 542 name in diff-raw format output and diff-tree header 543 - lines, show the shortest prefix that is at least '<n>' 543 + lines, show the shortest prefix that is at least _<n>_ 544 544 hexdigits long that uniquely refers the object. 545 545 In diff-patch output format, `--full-index` takes higher 546 546 precedence, i.e. if `--full-index` is specified, full blob 547 547 names will be shown regardless of `--abbrev`. 548 548 Non default number of digits can be specified with `--abbrev=<n>`. 549 549 550 - -B[<n>][/<m>]:: 551 - --break-rewrites[=[<n>][/<m>]]:: 550 + `-B[<n>][/<m>]`:: 551 + `--break-rewrites[=[<n>][/<m>]]`:: 552 552 Break complete rewrite changes into pairs of delete and 553 553 create. This serves two purposes: 554 554 + ··· 556 556 not as a series of deletion and insertion mixed together with a very 557 557 few lines that happen to match textually as the context, but as a 558 558 single deletion of everything old followed by a single insertion of 559 - everything new, and the number `m` controls this aspect of the -B 559 + everything new, and the number _<m>_ controls this aspect of the `-B` 560 560 option (defaults to 60%). `-B/70%` specifies that less than 30% of the 561 561 original should remain in the result for Git to consider it a total 562 562 rewrite (i.e. otherwise the resulting patch will be a series of 563 563 deletion and insertion mixed together with context lines). 564 564 + 565 - When used with -M, a totally-rewritten file is also considered as the 566 - source of a rename (usually -M only considers a file that disappeared 567 - as the source of a rename), and the number `n` controls this aspect of 568 - the -B option (defaults to 50%). `-B20%` specifies that a change with 565 + When used with `-M`, a totally-rewritten file is also considered as the 566 + source of a rename (usually `-M` only considers a file that disappeared 567 + as the source of a rename), and the number _<n>_ controls this aspect of 568 + the `-B` option (defaults to 50%). `-B20%` specifies that a change with 569 569 addition and deletion compared to 20% or more of the file's size are 570 570 eligible for being picked up as a possible source of a rename to 571 571 another file. 572 572 573 - -M[<n>]:: 574 - --find-renames[=<n>]:: 573 + `-M[<n>]`:: 574 + `--find-renames[=<n>]`:: 575 575 ifndef::git-log[] 576 576 Detect renames. 577 577 endif::git-log[] ··· 580 580 For following files across renames while traversing history, see 581 581 `--follow`. 582 582 endif::git-log[] 583 - If `n` is specified, it is a threshold on the similarity 583 + If _<n>_ is specified, it is a threshold on the similarity 584 584 index (i.e. amount of addition/deletions compared to the 585 585 file's size). For example, `-M90%` means Git should consider a 586 586 delete/add pair to be a rename if more than 90% of the file ··· 590 590 the same as `-M5%`. To limit detection to exact renames, use 591 591 `-M100%`. The default similarity index is 50%. 592 592 593 - -C[<n>]:: 594 - --find-copies[=<n>]:: 593 + `-C[<n>]`:: 594 + `--find-copies[=<n>]`:: 595 595 Detect copies as well as renames. See also `--find-copies-harder`. 596 - If `n` is specified, it has the same meaning as for `-M<n>`. 596 + If _<n>_ is specified, it has the same meaning as for `-M<n>`. 597 597 598 - --find-copies-harder:: 598 + `--find-copies-harder`:: 599 599 For performance reasons, by default, `-C` option finds copies only 600 600 if the original file of the copy was modified in the same 601 601 changeset. This flag makes the command ··· 604 604 projects, so use it with caution. Giving more than one 605 605 `-C` option has the same effect. 606 606 607 - -D:: 608 - --irreversible-delete:: 607 + `-D`:: 608 + `--irreversible-delete`:: 609 609 Omit the preimage for deletes, i.e. print only the header but not 610 610 the diff between the preimage and `/dev/null`. The resulting patch 611 611 is not meant to be applied with `patch` or `git apply`; this is ··· 617 617 When used together with `-B`, omit also the preimage in the deletion part 618 618 of a delete/create pair. 619 619 620 - -l<num>:: 620 + `-l<num>`:: 621 621 The `-M` and `-C` options involve some preliminary steps that 622 622 can detect subsets of renames/copies cheaply, followed by an 623 623 exhaustive fallback portion that compares all remaining ··· 627 627 destinations, this exhaustive check is O(N^2). This option 628 628 prevents the exhaustive portion of rename/copy detection from 629 629 running if the number of source/destination files involved 630 - exceeds the specified number. Defaults to diff.renameLimit. 630 + exceeds the specified number. Defaults to `diff.renameLimit`. 631 631 Note that a value of 0 is treated as unlimited. 632 632 633 633 ifndef::git-format-patch[] 634 - --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]:: 634 + `--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]`:: 635 635 Select only files that are Added (`A`), Copied (`C`), 636 636 Deleted (`D`), Modified (`M`), Renamed (`R`), have their 637 637 type (i.e. regular file, symlink, submodule, ...) changed (`T`), ··· 649 649 Note that not all diffs can feature all types. For instance, copied and 650 650 renamed entries cannot appear if detection for those types is disabled. 651 651 652 - -S<string>:: 652 + `-S<string>`:: 653 653 Look for differences that change the number of occurrences of 654 - the specified string (i.e. addition/deletion) in a file. 654 + the specified _<string>_ (i.e. addition/deletion) in a file. 655 655 Intended for the scripter's use. 656 656 + 657 657 It is useful when you're looking for an exact block of code (like a ··· 662 662 + 663 663 Binary files are searched as well. 664 664 665 - -G<regex>:: 665 + `-G<regex>`:: 666 666 Look for differences whose patch text contains added/removed 667 - lines that match <regex>. 667 + lines that match _<regex>_. 668 668 + 669 - To illustrate the difference between `-S<regex> --pickaxe-regex` and 669 + To illustrate the difference between `-S<regex>` `--pickaxe-regex` and 670 670 `-G<regex>`, consider a commit with the following diff in the same 671 671 file: 672 672 + ··· 686 686 See the 'pickaxe' entry in linkgit:gitdiffcore[7] for more 687 687 information. 688 688 689 - --find-object=<object-id>:: 689 + `--find-object=<object-id>`:: 690 690 Look for differences that change the number of occurrences of 691 691 the specified object. Similar to `-S`, just the argument is different 692 692 in that it doesn't search for a specific string but for a specific ··· 695 695 The object can be a blob or a submodule commit. It implies the `-t` option in 696 696 `git-log` to also find trees. 697 697 698 - --pickaxe-all:: 698 + `--pickaxe-all`:: 699 699 When `-S` or `-G` finds a change, show all the changes in that 700 700 changeset, not just the files that contain the change 701 - in <string>. 701 + in _<string>_. 702 702 703 - --pickaxe-regex:: 704 - Treat the <string> given to `-S` as an extended POSIX regular 703 + `--pickaxe-regex`:: 704 + Treat the _<string>_ given to `-S` as an extended POSIX regular 705 705 expression to match. 706 706 707 707 endif::git-format-patch[] 708 708 709 - -O<orderfile>:: 709 + `-O<orderfile>`:: 710 710 Control the order in which files appear in the output. 711 711 This overrides the `diff.orderFile` configuration variable 712 712 (see linkgit:git-config[1]). To cancel `diff.orderFile`, 713 713 use `-O/dev/null`. 714 714 + 715 715 The output order is determined by the order of glob patterns in 716 - <orderfile>. 716 + _<orderfile>_. 717 717 All files with pathnames that match the first pattern are output 718 718 first, all files with pathnames that match the second pattern (but not 719 719 the first) are output next, and so on. ··· 724 724 but no earlier patterns), their output order relative to each other is 725 725 the normal order. 726 726 + 727 - <orderfile> is parsed as follows: 727 + _<orderfile>_ is parsed as follows: 728 728 + 729 729 -- 730 730 - Blank lines are ignored, so they can be used as separators for ··· 738 738 -- 739 739 + 740 740 Patterns have the same syntax and semantics as patterns used for 741 - fnmatch(3) without the FNM_PATHNAME flag, except a pathname also 741 + `fnmatch`(3) without the `FNM_PATHNAME` flag, except a pathname also 742 742 matches a pattern if removing any number of the final pathname 743 743 components matches the pattern. For example, the pattern "`foo*bar`" 744 744 matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`". 745 745 746 - --skip-to=<file>:: 747 - --rotate-to=<file>:: 748 - Discard the files before the named <file> from the output 746 + `--skip-to=<file>`:: 747 + `--rotate-to=<file>`:: 748 + Discard the files before the named _<file>_ from the output 749 749 (i.e. 'skip to'), or move them to the end of the output 750 750 (i.e. 'rotate to'). These options were invented primarily for the use 751 751 of the `git difftool` command, and may not be very useful 752 752 otherwise. 753 753 754 754 ifndef::git-format-patch[] 755 - -R:: 755 + `-R`:: 756 756 Swap two inputs; that is, show differences from index or 757 757 on-disk file to tree contents. 758 758 endif::git-format-patch[] 759 759 760 - --relative[=<path>]:: 761 - --no-relative:: 760 + `--relative[=<path>]`:: 761 + `--no-relative`:: 762 762 When run from a subdirectory of the project, it can be 763 763 told to exclude changes outside the directory and show 764 764 pathnames relative to it with this option. When you are 765 765 not in a subdirectory (e.g. in a bare repository), you 766 766 can name which subdirectory to make the output relative 767 - to by giving a <path> as an argument. 767 + to by giving a _<path>_ as an argument. 768 768 `--no-relative` can be used to countermand both `diff.relative` config 769 769 option and previous `--relative`. 770 770 771 - -a:: 772 - --text:: 771 + `-a`:: 772 + `--text`:: 773 773 Treat all files as text. 774 774 775 - --ignore-cr-at-eol:: 775 + `--ignore-cr-at-eol`:: 776 776 Ignore carriage-return at the end of line when doing a comparison. 777 777 778 - --ignore-space-at-eol:: 778 + `--ignore-space-at-eol`:: 779 779 Ignore changes in whitespace at EOL. 780 780 781 - -b:: 782 - --ignore-space-change:: 781 + `-b`:: 782 + `--ignore-space-change`:: 783 783 Ignore changes in amount of whitespace. This ignores whitespace 784 784 at line end, and considers all other sequences of one or 785 785 more whitespace characters to be equivalent. 786 786 787 - -w:: 788 - --ignore-all-space:: 787 + `-w`:: 788 + `--ignore-all-space`:: 789 789 Ignore whitespace when comparing lines. This ignores 790 790 differences even if one line has whitespace where the other 791 791 line has none. 792 792 793 - --ignore-blank-lines:: 793 + `--ignore-blank-lines`:: 794 794 Ignore changes whose lines are all blank. 795 795 796 - -I<regex>:: 797 - --ignore-matching-lines=<regex>:: 798 - Ignore changes whose all lines match <regex>. This option may 796 + 797 + `-I<regex>`:: 798 + `--ignore-matching-lines=<regex>`:: 799 + Ignore changes whose all lines match _<regex>_. This option may 799 800 be specified more than once. 800 801 801 - --inter-hunk-context=<lines>:: 802 - Show the context between diff hunks, up to the specified number 802 + `--inter-hunk-context=<number>`:: 803 + Show the context between diff hunks, up to the specified _<number>_ 803 804 of lines, thereby fusing hunks that are close to each other. 804 805 Defaults to `diff.interHunkContext` or 0 if the config option 805 806 is unset. 806 807 807 - -W:: 808 - --function-context:: 808 + `-W`:: 809 + `--function-context`:: 809 810 Show whole function as context lines for each change. 810 811 The function names are determined in the same way as 811 - `git diff` works out patch hunk headers (see 'Defining a 812 - custom hunk-header' in linkgit:gitattributes[5]). 812 + `git diff` works out patch hunk headers (see "Defining a 813 + custom hunk-header" in linkgit:gitattributes[5]). 813 814 814 815 ifndef::git-format-patch[] 815 816 ifndef::git-log[] 816 - --exit-code:: 817 - Make the program exit with codes similar to diff(1). 817 + `--exit-code`:: 818 + Make the program exit with codes similar to `diff`(1). 818 819 That is, it exits with 1 if there were differences and 819 820 0 means no differences. 820 821 821 - --quiet:: 822 + `--quiet`:: 822 823 Disable all output of the program. Implies `--exit-code`. 823 824 Disables execution of external diff helpers whose exit code 824 825 is not trusted, i.e. their respective configuration option 825 - `diff.trustExitCode` or `diff.<driver>.trustExitCode` or 826 + `diff.trustExitCode` or ++diff.++__<driver>__++.trustExitCode++ or 826 827 environment variable `GIT_EXTERNAL_DIFF_TRUST_EXIT_CODE` is 827 828 false. 828 829 endif::git-log[] 829 830 endif::git-format-patch[] 830 831 831 - --ext-diff:: 832 + `--ext-diff`:: 832 833 Allow an external diff helper to be executed. If you set an 833 834 external diff driver with linkgit:gitattributes[5], you need 834 835 to use this option with linkgit:git-log[1] and friends. 835 836 836 - --no-ext-diff:: 837 + `--no-ext-diff`:: 837 838 Disallow external diff drivers. 838 839 839 - --textconv:: 840 - --no-textconv:: 840 + `--textconv`:: 841 + `--no-textconv`:: 841 842 Allow (or disallow) external text conversion filters to be run 842 843 when comparing binary files. See linkgit:gitattributes[5] for 843 844 details. Because textconv filters are typically a one-way ··· 847 848 linkgit:git-log[1], but not for linkgit:git-format-patch[1] or 848 849 diff plumbing commands. 849 850 850 - --ignore-submodules[=<when>]:: 851 - Ignore changes to submodules in the diff generation. <when> can be 852 - either "none", "untracked", "dirty" or "all", which is the default. 853 - Using "none" will consider the submodule modified when it either contains 854 - untracked or modified files or its HEAD differs from the commit recorded 851 + 852 + `--ignore-submodules[=(none|untracked|dirty|all)]`:: 853 + Ignore changes to submodules in the diff generation. `all` is the default. 854 + Using `none` will consider the submodule modified when it either contains 855 + untracked or modified files or its `HEAD` differs from the commit recorded 855 856 in the superproject and can be used to override any settings of the 856 - 'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When 857 - "untracked" is used submodules are not considered dirty when they only 857 + `ignore` option in linkgit:git-config[1] or linkgit:gitmodules[5]. When 858 + `untracked` is used submodules are not considered dirty when they only 858 859 contain untracked content (but they are still scanned for modified 859 - content). Using "dirty" ignores all changes to the work tree of submodules, 860 + content). Using `dirty` ignores all changes to the work tree of submodules, 860 861 only changes to the commits stored in the superproject are shown (this was 861 - the behavior until 1.7.0). Using "all" hides all changes to submodules. 862 + the behavior until 1.7.0). Using `all` hides all changes to submodules. 862 863 863 - --src-prefix=<prefix>:: 864 - Show the given source prefix instead of "a/". 864 + `--src-prefix=<prefix>`:: 865 + Show the given source _<prefix>_ instead of "a/". 865 866 866 - --dst-prefix=<prefix>:: 867 - Show the given destination prefix instead of "b/". 867 + `--dst-prefix=<prefix>`:: 868 + Show the given destination _<prefix>_ instead of "b/". 868 869 869 - --no-prefix:: 870 + `--no-prefix`:: 870 871 Do not show any source or destination prefix. 871 872 872 - --default-prefix:: 873 + `--default-prefix`:: 873 874 Use the default source and destination prefixes ("a/" and "b/"). 874 875 This overrides configuration variables such as `diff.noprefix`, 875 876 `diff.srcPrefix`, `diff.dstPrefix`, and `diff.mnemonicPrefix` 876 - (see `git-config`(1)). 877 + (see linkgit:git-config[1]). 877 878 878 - --line-prefix=<prefix>:: 879 - Prepend an additional prefix to every line of output. 879 + `--line-prefix=<prefix>`:: 880 + Prepend an additional _<prefix>_ to every line of output. 880 881 881 - --ita-invisible-in-index:: 882 - By default entries added by "git add -N" appear as an existing 883 - empty file in "git diff" and a new file in "git diff --cached". 884 - This option makes the entry appear as a new file in "git diff" 885 - and non-existent in "git diff --cached". This option could be 882 + `--ita-invisible-in-index`:: 883 + By default entries added by `git add -N` appear as an existing 884 + empty file in `git diff` and a new file in `git diff --cached`. 885 + This option makes the entry appear as a new file in `git diff` 886 + and non-existent in `git diff --cached`. This option could be 886 887 reverted with `--ita-visible-in-index`. Both options are 887 888 experimental and could be removed in future. 888 889
+66 -56
Documentation/git-diff.txt
··· 8 8 9 9 SYNOPSIS 10 10 -------- 11 - [verse] 12 - 'git diff' [<options>] [<commit>] [--] [<path>...] 13 - 'git diff' [<options>] --cached [--merge-base] [<commit>] [--] [<path>...] 14 - 'git diff' [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...] 15 - 'git diff' [<options>] <commit>...<commit> [--] [<path>...] 16 - 'git diff' [<options>] <blob> <blob> 17 - 'git diff' [<options>] --no-index [--] <path> <path> 11 + [synopsis] 12 + git diff [<options>] [<commit>] [--] [<path>...] 13 + git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>...] 14 + git diff [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...] 15 + git diff [<options>] <commit>...<commit> [--] [<path>...] 16 + git diff [<options>] <blob> <blob> 17 + git diff [<options>] --no-index [--] <path> <path> 18 18 19 19 DESCRIPTION 20 20 ----------- ··· 23 23 from a merge, changes between two blob objects, or changes between two 24 24 files on disk. 25 25 26 - 'git diff' [<options>] [--] [<path>...]:: 26 + `git diff [<options>] [--] [<path>...]`:: 27 27 28 28 This form is to view the changes you made relative to 29 29 the index (staging area for the next commit). In other ··· 31 31 further add to the index but you still haven't. You can 32 32 stage these changes by using linkgit:git-add[1]. 33 33 34 - 'git diff' [<options>] --no-index [--] <path> <path>:: 34 + `git diff [<options>] --no-index [--] <path> <path>`:: 35 35 36 36 This form is to compare the given two paths on the 37 37 filesystem. You can omit the `--no-index` option when ··· 40 40 or when running the command outside a working tree 41 41 controlled by Git. This form implies `--exit-code`. 42 42 43 - 'git diff' [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]:: 43 + `git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]`:: 44 44 45 45 This form is to view the changes you staged for the next 46 - commit relative to the named <commit>. Typically you 46 + commit relative to the named _<commit>_. Typically you 47 47 would want comparison with the latest commit, so if you 48 - do not give <commit>, it defaults to HEAD. 49 - If HEAD does not exist (e.g. unborn branches) and 50 - <commit> is not given, it shows all staged changes. 51 - --staged is a synonym of --cached. 48 + do not give _<commit>_, it defaults to `HEAD`. 49 + If `HEAD` does not exist (e.g. unborn branches) and 50 + _<commit>_ is not given, it shows all staged changes. 51 + `--staged` is a synonym of `--cached`. 52 52 + 53 - If --merge-base is given, instead of using <commit>, use the merge base 54 - of <commit> and HEAD. `git diff --cached --merge-base A` is equivalent to 53 + If `--merge-base` is given, instead of using _<commit>_, use the merge base 54 + of _<commit>_ and `HEAD`. `git diff --cached --merge-base A` is equivalent to 55 55 `git diff --cached $(git merge-base A HEAD)`. 56 56 57 - 'git diff' [<options>] [--merge-base] <commit> [--] [<path>...]:: 57 + `git diff [<options>] [--merge-base] <commit> [--] [<path>...]`:: 58 58 59 59 This form is to view the changes you have in your 60 - working tree relative to the named <commit>. You can 61 - use HEAD to compare it with the latest commit, or a 60 + working tree relative to the named _<commit>_. You can 61 + use `HEAD` to compare it with the latest commit, or a 62 62 branch name to compare with the tip of a different 63 63 branch. 64 64 + 65 - If --merge-base is given, instead of using <commit>, use the merge base 66 - of <commit> and HEAD. `git diff --merge-base A` is equivalent to 65 + If `--merge-base` is given, instead of using _<commit>_, use the merge base 66 + of _<commit>_ and `HEAD`. `git diff --merge-base A` is equivalent to 67 67 `git diff $(git merge-base A HEAD)`. 68 68 69 - 'git diff' [<options>] [--merge-base] <commit> <commit> [--] [<path>...]:: 69 + `git diff [<options>] [--merge-base] <commit> <commit> [--] [<path>...]`:: 70 70 71 71 This is to view the changes between two arbitrary 72 - <commit>. 72 + _<commit>_. 73 73 + 74 - If --merge-base is given, use the merge base of the two commits for the 74 + If `--merge-base` is given, use the merge base of the two commits for the 75 75 "before" side. `git diff --merge-base A B` is equivalent to 76 76 `git diff $(git merge-base A B) B`. 77 77 78 - 'git diff' [<options>] <commit> <commit>... <commit> [--] [<path>...]:: 78 + `git diff [<options>] <commit> <commit>...<commit> [--] [<path>...]`:: 79 79 80 80 This form is to view the results of a merge commit. The first 81 - listed <commit> must be the merge itself; the remaining two or 81 + listed _<commit>_ must be the merge itself; the remaining two or 82 82 more commits should be its parents. Convenient ways to produce 83 - the desired set of revisions are to use the suffixes `^@` and 84 - `^!`. If A is a merge commit, then `git diff A A^@`, 83 + the desired set of revisions are to use the suffixes `@` and 84 + `^!`. If `A` is a merge commit, then `git diff A A^@`, 85 85 `git diff A^!` and `git show A` all give the same combined diff. 86 86 87 - 'git diff' [<options>] <commit>..<commit> [--] [<path>...]:: 87 + `git diff [<options>] <commit>..<commit> [--] [<path>...]`:: 88 88 89 89 This is synonymous to the earlier form (without the `..`) for 90 - viewing the changes between two arbitrary <commit>. If <commit> on 90 + viewing the changes between two arbitrary _<commit>_. If _<commit>_ on 91 91 one side is omitted, it will have the same effect as 92 - using HEAD instead. 92 + using `HEAD` instead. 93 93 94 - 'git diff' [<options>] <commit>\...<commit> [--] [<path>...]:: 94 + `git diff [<options>] <commit>...<commit> [--] [<path>...]`:: 95 95 96 96 This form is to view the changes on the branch containing 97 - and up to the second <commit>, starting at a common ancestor 98 - of both <commit>. `git diff A...B` is equivalent to 97 + and up to the second _<commit>_, starting at a common ancestor 98 + of both _<commit>_. `git diff A...B` is equivalent to 99 99 `git diff $(git merge-base A B) B`. You can omit any one 100 - of <commit>, which has the same effect as using HEAD instead. 100 + of _<commit>_, which has the same effect as using `HEAD` instead. 101 101 102 102 Just in case you are doing something exotic, it should be 103 - noted that all of the <commit> in the above description, except 103 + noted that all of the _<commit>_ in the above description, except 104 104 in the `--merge-base` case and in the last two forms that use `..` 105 - notations, can be any <tree>. A tree of interest is the one pointed to 106 - by the ref named `AUTO_MERGE`, which is written by the 'ort' merge 105 + notations, can be any _<tree>_. A tree of interest is the one pointed to 106 + by the ref named `AUTO_MERGE`, which is written by the `ort` merge 107 107 strategy upon hitting merge conflicts (see linkgit:git-merge[1]). 108 108 Comparing the working tree with `AUTO_MERGE` shows changes you've made 109 109 so far to resolve textual conflicts (see the examples below). 110 110 111 - For a more complete list of ways to spell <commit>, see 111 + For a more complete list of ways to spell _<commit>_, see 112 112 "SPECIFYING REVISIONS" section in linkgit:gitrevisions[7]. 113 - However, "diff" is about comparing two _endpoints_, not ranges, 114 - and the range notations (`<commit>..<commit>` and 115 - `<commit>...<commit>`) do not mean a range as defined in the 113 + However, `diff` is about comparing two _endpoints_, not ranges, 114 + and the range notations (`<commit>..<commit>` and `<commit>...<commit>`) 115 + do not mean a range as defined in the 116 116 "SPECIFYING RANGES" section in linkgit:gitrevisions[7]. 117 117 118 - 'git diff' [<options>] <blob> <blob>:: 118 + `git diff [<options>] <blob> <blob>`:: 119 119 120 120 This form is to view the differences between the raw 121 121 contents of two blob objects. ··· 125 125 :git-diff: 1 126 126 include::diff-options.txt[] 127 127 128 - -1 --base:: 129 - -2 --ours:: 130 - -3 --theirs:: 131 - Compare the working tree with the "base" version (stage #1), 132 - "our branch" (stage #2) or "their branch" (stage #3). The 133 - index contains these stages only for unmerged entries i.e. 134 - while resolving conflicts. See linkgit:git-read-tree[1] 135 - section "3-Way Merge" for detailed information. 128 + `-1`:: 129 + `--base`:: 130 + `-2`:: 131 + `--ours`:: 132 + `-3`:: 133 + `--theirs`:: 134 + Compare the working tree with 135 + + 136 + -- 137 + * the "base" version (stage #1) when using `-1` or `--base`, 138 + * "our branch" (stage #2) when using `-2` or `--ours`, or 139 + * "their branch" (stage #3) when using `-3` or `--theirs`. 140 + -- 141 + + 142 + The index contains these stages only for unmerged entries i.e. 143 + while resolving conflicts. See linkgit:git-read-tree[1] 144 + section "3-Way Merge" for detailed information. 136 145 137 - -0:: 146 + `-0`:: 138 147 Omit diff output for unmerged entries and just show 139 148 "Unmerged". Can be used only when comparing the working tree 140 149 with the index. 141 150 142 - <path>...:: 143 - The <paths> parameters, when given, are used to limit 151 + `<path>...`:: 152 + The _<path>_ parameters, when given, are used to limit 144 153 the diff to the named paths (you can give directory 145 154 names and get diff for all files under them). 146 155 ··· 225 234 226 235 include::includes/cmd-config-section-all.txt[] 227 236 237 + :git-diff: 1 228 238 include::config/diff.txt[] 229 239 230 240 SEE ALSO 231 241 -------- 232 - diff(1), 242 + `diff`(1), 233 243 linkgit:git-difftool[1], 234 244 linkgit:git-log[1], 235 245 linkgit:gitdiffcore[7],