From: Junio C Hamano Date: Fri, 7 Dec 2007 09:50:49 +0000 (+0000) Subject: Autogenerated HTML docs for v1.5.3.7-1112-g9758e X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=00b8b63aed8bf4125893dccb3bacec74f8a2d892;p=git.git Autogenerated HTML docs for v1.5.3.7-1112-g9758e --- diff --git a/RelNotes-1.5.4.txt b/RelNotes-1.5.4.txt index c40fd1805..c1ebd6997 100644 --- a/RelNotes-1.5.4.txt +++ b/RelNotes-1.5.4.txt @@ -155,6 +155,9 @@ Updates since v1.5.3 * "git cvsserver" can be run via "git shell". + * "git cvsserver" acts more like receive-pack by running post-receive + and post-update hooks. + * "git am" and "git rebase" are far less verbose. * "git pull" learned to pass --[no-]ff option to underlying "git @@ -166,6 +169,13 @@ Updates since v1.5.3 * "git fast-export" produces datastream that can be fed to fast-import to reproduce the history recorded in a git repository. + * "git add -i" takes pathspecs to limit the set of files to work on. + + * "git add -p" is a short-hand to go directly to the selective patch + subcommand in the interactive command loop and to exit when done. + + * "git add -i" UI has been colorized. + * "git commit --allow-empty" allows you to create a single-parent commit that records the same tree as its parent, overriding the usual safety valve. @@ -173,6 +183,8 @@ Updates since v1.5.3 * "git commit --amend" can amend a merge that does not change the tree from its first parent. + * "git commit" has been rewritten in C. + * "git stash random-text" does not create a new stash anymore. It was a UI mistake. Use "git stash save random-text", or "git stash" (without extra args) for that. @@ -249,8 +261,11 @@ series. * "git svn" talking with the SVN over http will correctly quote branch and project names. + * "git config" did not work correctly on platforms that define + REG_NOMATCH to an even number. + -- exec >/var/tmp/1 -O=v1.5.3.7-1003-gf38ca7c +O=v1.5.3.7-1111-gd9f4059 echo O=`git describe refs/heads/master` git shortlog --no-merges $O..refs/heads/master ^refs/heads/maint diff --git a/config.txt b/config.txt index 0e45ec547..736fcd71c 100644 --- a/config.txt +++ b/config.txt @@ -391,6 +391,18 @@ color.diff.:: whitespace). The values of these variables may be specified as in color.branch.. +color.interactive:: + When set to `always`, always use colors in `git add --interactive`. + When false (or `never`), never. When set to `true` or `auto`, use + colors only when the output is to the terminal. Defaults to false. + +color.interactive.:: + Use customized color for `git add --interactive` + output. `` may be `prompt`, `header`, or `help`, for + three distinct types of normal output from interactive + programs. The values of these variables may be specified as + in color.branch.. + color.pager:: A boolean to enable/disable colored output when the pager is in use (default is true). diff --git a/diff-format.txt b/diff-format.txt index 9709c35c9..2c3a4c433 100644 --- a/diff-format.txt +++ b/diff-format.txt @@ -83,161 +83,4 @@ Note that 'combined diff' lists only files which were modified from all parents. -Generating patches with -p --------------------------- - -When "git-diff-index", "git-diff-tree", or "git-diff-files" are run -with a '-p' option, or "git diff" without the '--raw' option, they -do not produce the output described above; instead they produce a -patch file. You can customize the creation of such patches via the -GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables. - -What the -p option produces is slightly different from the traditional -diff format. - -1. It is preceded with a "git diff" header, that looks like - this: - - diff --git a/file1 b/file2 -+ -The `a/` and `b/` filenames are the same unless rename/copy is -involved. Especially, even for a creation or a deletion, -`/dev/null` is _not_ used in place of `a/` or `b/` filenames. -+ -When rename/copy is involved, `file1` and `file2` show the -name of the source file of the rename/copy and the name of -the file that rename/copy produces, respectively. - -2. It is followed by one or more extended header lines: - - old mode - new mode - deleted file mode - new file mode - copy from - copy to - rename from - rename to - similarity index - dissimilarity index - index .. - -3. TAB, LF, double quote and backslash characters in pathnames - are represented as `\t`, `\n`, `\"` and `\\`, respectively. - If there is need for such substitution then the whole - pathname is put in double quotes. - -The similarity index is the percentage of unchanged lines, and -the dissimilarity index is the percentage of changed lines. It -is a rounded down integer, followed by a percent sign. The -similarity index value of 100% is thus reserved for two equal -files, while 100% dissimilarity means that no line from the old -file made it into the new one. - - -combined diff format --------------------- - -"git-diff-tree", "git-diff-files" and "git-diff" can take '-c' or -'--cc' option to produce 'combined diff', which looks like this: - ------------- -diff --combined describe.c -index fabadb8,cc95eb0..4866510 ---- a/describe.c -+++ b/describe.c -@@@ -98,20 -98,12 +98,20 @@@ - return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1; - } - -- static void describe(char *arg) - -static void describe(struct commit *cmit, int last_one) -++static void describe(char *arg, int last_one) - { - + unsigned char sha1[20]; - + struct commit *cmit; - struct commit_list *list; - static int initialized = 0; - struct commit_name *n; - - + if (get_sha1(arg, sha1) < 0) - + usage(describe_usage); - + cmit = lookup_commit_reference(sha1); - + if (!cmit) - + usage(describe_usage); - + - if (!initialized) { - initialized = 1; - for_each_ref(get_name); ------------- - -1. It is preceded with a "git diff" header, that looks like - this (when '-c' option is used): - - diff --combined file -+ -or like this (when '--cc' option is used): - - diff --c file - -2. It is followed by one or more extended header lines - (this example shows a merge with two parents): - - index ,.. - mode ,.. - new file mode - deleted file mode , -+ -The `mode ,..` line appears only if at least one of -the is different from the rest. Extended headers with -information about detected contents movement (renames and -copying detection) are designed to work with diff of two - and are not used by combined diff format. - -3. It is followed by two-line from-file/to-file header - - --- a/file - +++ b/file -+ -Similar to two-line header for traditional 'unified' diff -format, `/dev/null` is used to signal created or deleted -files. - -4. Chunk header format is modified to prevent people from - accidentally feeding it to `patch -p1`. Combined diff format - was created for review of merge commit changes, and was not - meant for apply. The change is similar to the change in the - extended 'index' header: - - @@@ @@@ -+ -There are (number of parents + 1) `@` characters in the chunk -header for combined diff format. - -Unlike the traditional 'unified' diff format, which shows two -files A and B with a single column that has `-` (minus -- -appears in A but removed in B), `+` (plus -- missing in A but -added to B), or `" "` (space -- unchanged) prefix, this format -compares two or more files file1, file2,... with one file X, and -shows how X differs from each of fileN. One column for each of -fileN is prepended to the output line to note how X's line is -different from it. - -A `-` character in the column N means that the line appears in -fileN but it does not appear in the result. A `+` character -in the column N means that the line appears in the last file, -and fileN does not have that line (in other words, the line was -added, from the point of view of that parent). - -In the above example output, the function signature was changed -from both files (hence two `-` removals from both file1 and -file2, plus `++` to mean one line that was added does not appear -in either file1 nor file2). Also two other lines are the same -from file1 but do not appear in file2 (hence prefixed with ` +`). - -When shown by `git diff-tree -c`, it compares the parents of a -merge commit with the merge result (i.e. file1..fileN are the -parents). When shown by `git diff-files -c`, it compares the -two unresolved merge parents with the working tree file -(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka -"their version"). +include::diff-generate-patch.txt[] diff --git a/diff-generate-patch.txt b/diff-generate-patch.txt new file mode 100644 index 000000000..029c5f2b8 --- /dev/null +++ b/diff-generate-patch.txt @@ -0,0 +1,161 @@ +Generating patches with -p +-------------------------- + +When "git-diff-index", "git-diff-tree", or "git-diff-files" are run +with a '-p' option, "git diff" without the '--raw' option, or +"git log" with the "-p" option, they +do not produce the output described above; instead they produce a +patch file. You can customize the creation of such patches via the +GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables. + +What the -p option produces is slightly different from the traditional +diff format. + +1. It is preceded with a "git diff" header, that looks like + this: + + diff --git a/file1 b/file2 ++ +The `a/` and `b/` filenames are the same unless rename/copy is +involved. Especially, even for a creation or a deletion, +`/dev/null` is _not_ used in place of `a/` or `b/` filenames. ++ +When rename/copy is involved, `file1` and `file2` show the +name of the source file of the rename/copy and the name of +the file that rename/copy produces, respectively. + +2. It is followed by one or more extended header lines: + + old mode + new mode + deleted file mode + new file mode + copy from + copy to + rename from + rename to + similarity index + dissimilarity index + index .. + +3. TAB, LF, double quote and backslash characters in pathnames + are represented as `\t`, `\n`, `\"` and `\\`, respectively. + If there is need for such substitution then the whole + pathname is put in double quotes. + +The similarity index is the percentage of unchanged lines, and +the dissimilarity index is the percentage of changed lines. It +is a rounded down integer, followed by a percent sign. The +similarity index value of 100% is thus reserved for two equal +files, while 100% dissimilarity means that no line from the old +file made it into the new one. + + +combined diff format +-------------------- + +"git-diff-tree", "git-diff-files" and "git-diff" can take '-c' or +'--cc' option to produce 'combined diff'. For showing a merge commit +with "git log -p", this is the default format. +A 'combined diff' format looks like this: + +------------ +diff --combined describe.c +index fabadb8,cc95eb0..4866510 +--- a/describe.c ++++ b/describe.c +@@@ -98,20 -98,12 +98,20 @@@ + return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1; + } + +- static void describe(char *arg) + -static void describe(struct commit *cmit, int last_one) +++static void describe(char *arg, int last_one) + { + + unsigned char sha1[20]; + + struct commit *cmit; + struct commit_list *list; + static int initialized = 0; + struct commit_name *n; + + + if (get_sha1(arg, sha1) < 0) + + usage(describe_usage); + + cmit = lookup_commit_reference(sha1); + + if (!cmit) + + usage(describe_usage); + + + if (!initialized) { + initialized = 1; + for_each_ref(get_name); +------------ + +1. It is preceded with a "git diff" header, that looks like + this (when '-c' option is used): + + diff --combined file ++ +or like this (when '--cc' option is used): + + diff --c file + +2. It is followed by one or more extended header lines + (this example shows a merge with two parents): + + index ,.. + mode ,.. + new file mode + deleted file mode , ++ +The `mode ,..` line appears only if at least one of +the is different from the rest. Extended headers with +information about detected contents movement (renames and +copying detection) are designed to work with diff of two + and are not used by combined diff format. + +3. It is followed by two-line from-file/to-file header + + --- a/file + +++ b/file ++ +Similar to two-line header for traditional 'unified' diff +format, `/dev/null` is used to signal created or deleted +files. + +4. Chunk header format is modified to prevent people from + accidentally feeding it to `patch -p1`. Combined diff format + was created for review of merge commit changes, and was not + meant for apply. The change is similar to the change in the + extended 'index' header: + + @@@ @@@ ++ +There are (number of parents + 1) `@` characters in the chunk +header for combined diff format. + +Unlike the traditional 'unified' diff format, which shows two +files A and B with a single column that has `-` (minus -- +appears in A but removed in B), `+` (plus -- missing in A but +added to B), or `" "` (space -- unchanged) prefix, this format +compares two or more files file1, file2,... with one file X, and +shows how X differs from each of fileN. One column for each of +fileN is prepended to the output line to note how X's line is +different from it. + +A `-` character in the column N means that the line appears in +fileN but it does not appear in the result. A `+` character +in the column N means that the line appears in the last file, +and fileN does not have that line (in other words, the line was +added, from the point of view of that parent). + +In the above example output, the function signature was changed +from both files (hence two `-` removals from both file1 and +file2, plus `++` to mean one line that was added does not appear +in either file1 nor file2). Also two other lines are the same +from file1 but do not appear in file2 (hence prefixed with ` +`). + +When shown by `git diff-tree -c`, it compares the parents of a +merge commit with the merge result (i.e. file1..fileN are the +parents). When shown by `git diff-files -c`, it compares the +two unresolved merge parents with the working tree file +(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka +"their version"). diff --git a/diff-options.txt b/diff-options.txt index e4af39351..d0154bbc0 100644 --- a/diff-options.txt +++ b/diff-options.txt @@ -6,7 +6,9 @@ ifndef::git-format-patch[] ifndef::git-diff[] +ifndef::git-log[] :git-diff-core: 1 +endif::git-log[] endif::git-diff[] endif::git-format-patch[] diff --git a/git-config.html b/git-config.html index d099933b6..65a7dbd26 100644 --- a/git-config.html +++ b/git-config.html @@ -284,7 +284,8 @@ git-config(1) Manual Page git-config [<file-option>] --rename-section old_name new_name git-config [<file-option>] --remove-section name git-config [<file-option>] [-z|--null] -l | --list -git-config [<file-option>] --get-color name [default] +git-config [<file-option>] --get-color name [default] +git-config [<file-option>] --get-colorbool name [stdout-is-tty]

DESCRIPTION

@@ -500,6 +501,19 @@ rather than from all available files.

+--get-colorbool name [stdout-is-tty] +
+
+

+ Find the color setting for name (e.g. color.diff) and output + "true" or "false". stdout-is-tty should be either "true" or + "false", and is taken into account when configuration says + "auto". If stdout-is-tty is missing, then checks the standard + output of the command itself, and exits with status 0 if color + is to be used, or exits with status 1 otherwise. +

+
+
--get-color name default
@@ -1225,6 +1239,28 @@ color.diff.<slot>

+color.interactive +
+
+

+ When set to always, always use colors in git add --interactive. + When false (or never), never. When set to true or auto, use + colors only when the output is to the terminal. Defaults to false. +

+
+
+color.interactive.<slot> +
+
+

+ Use customized color for git add --interactive + output. <slot> may be prompt, header, or help, for + three distinct types of normal output from interactive + programs. The values of these variables may be specified as + in color.branch.<slot>. +

+
+
color.pager
@@ -2026,7 +2062,7 @@ transfer.unpackLimit
diff --git a/git-config.txt b/git-config.txt index 764045078..98509b4f4 100644 --- a/git-config.txt +++ b/git-config.txt @@ -21,6 +21,7 @@ SYNOPSIS 'git-config' [] --remove-section name 'git-config' [] [-z|--null] -l | --list 'git-config' [] --get-color name [default] +'git-config' [] --get-colorbool name [stdout-is-tty] DESCRIPTION ----------- @@ -135,6 +136,15 @@ See also <>. output without getting confused e.g. by values that contain line breaks. +--get-colorbool name [stdout-is-tty]:: + + Find the color setting for `name` (e.g. `color.diff`) and output + "true" or "false". `stdout-is-tty` should be either "true" or + "false", and is taken into account when configuration says + "auto". If `stdout-is-tty` is missing, then checks the standard + output of the command itself, and exits with status 0 if color + is to be used, or exits with status 1 otherwise. + --get-color name default:: Find the color configured for `name` (e.g. `color.diff.new`) and diff --git a/git-diff-files.html b/git-diff-files.html index b3bfaa41f..9931e6223 100644 --- a/git-diff-files.html +++ b/git-diff-files.html @@ -923,7 +923,8 @@ all parents.

Generating patches with -p

When "git-diff-index", "git-diff-tree", or "git-diff-files" are run -with a -p option, or "git diff" without the --raw option, they +with a -p option, "git diff" without the --raw option, or +"git log" with the "-p" option, they do not produce the output described above; instead they produce a patch file. You can customize the creation of such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.

@@ -984,7 +985,9 @@ file made it into the new one.

combined diff format

"git-diff-tree", "git-diff-files" and "git-diff" can take -c or ---cc option to produce combined diff, which looks like this:

+--cc option to produce combined diff. For showing a merge commit +with "git log -p", this is the default format. +A combined diff format looks like this:

diff --combined describe.c
@@ -1117,7 +1120,7 @@ two unresolved merge parents with the working tree file
 
diff --git a/git-diff-index.html b/git-diff-index.html index a511a26d6..3e139778a 100644 --- a/git-diff-index.html +++ b/git-diff-index.html @@ -911,7 +911,8 @@ all parents.

Generating patches with -p

When "git-diff-index", "git-diff-tree", or "git-diff-files" are run -with a -p option, or "git diff" without the --raw option, they +with a -p option, "git diff" without the --raw option, or +"git log" with the "-p" option, they do not produce the output described above; instead they produce a patch file. You can customize the creation of such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.

@@ -972,7 +973,9 @@ file made it into the new one.

combined diff format

"git-diff-tree", "git-diff-files" and "git-diff" can take -c or ---cc option to produce combined diff, which looks like this:

+--cc option to produce combined diff. For showing a merge commit +with "git log -p", this is the default format. +A combined diff format looks like this:

diff --combined describe.c
@@ -1199,7 +1202,7 @@ always have the special all-zero sha1.
 
diff --git a/git-diff-tree.html b/git-diff-tree.html index 582767159..887133b3c 100644 --- a/git-diff-tree.html +++ b/git-diff-tree.html @@ -1393,7 +1393,8 @@ all parents.

Generating patches with -p

When "git-diff-index", "git-diff-tree", or "git-diff-files" are run -with a -p option, or "git diff" without the --raw option, they +with a -p option, "git diff" without the --raw option, or +"git log" with the "-p" option, they do not produce the output described above; instead they produce a patch file. You can customize the creation of such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.

@@ -1454,7 +1455,9 @@ file made it into the new one.

combined diff format

"git-diff-tree", "git-diff-files" and "git-diff" can take -c or ---cc option to produce combined diff, which looks like this:

+--cc option to produce combined diff. For showing a merge commit +with "git log -p", this is the default format. +A combined diff format looks like this:

diff --combined describe.c
@@ -1587,7 +1590,7 @@ two unresolved merge parents with the working tree file
 
diff --git a/git-diff.html b/git-diff.html index 3b7e36e65..6a16c477d 100644 --- a/git-diff.html +++ b/git-diff.html @@ -972,7 +972,8 @@ all parents.

Generating patches with -p

When "git-diff-index", "git-diff-tree", or "git-diff-files" are run -with a -p option, or "git diff" without the --raw option, they +with a -p option, "git diff" without the --raw option, or +"git log" with the "-p" option, they do not produce the output described above; instead they produce a patch file. You can customize the creation of such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.

@@ -1033,7 +1034,9 @@ file made it into the new one.

combined diff format

"git-diff-tree", "git-diff-files" and "git-diff" can take -c or ---cc option to produce combined diff, which looks like this:

+--cc option to produce combined diff. For showing a merge commit +with "git log -p", this is the default format. +A combined diff format looks like this:

diff --combined describe.c
@@ -1314,7 +1317,7 @@ Output diff in reverse.
 
diff --git a/git-format-patch.html b/git-format-patch.html index b09edc6cb..889847de5 100644 --- a/git-format-patch.html +++ b/git-format-patch.html @@ -991,7 +991,7 @@ git-format-patch -3
diff --git a/git-log.html b/git-log.html index a078ac659..98ee2d3d7 100644 --- a/git-log.html +++ b/git-log.html @@ -322,6 +322,422 @@ people using 80-column terminals.

defaults to UTF-8.

+ +
+
+-p +
+
+

+ Generate patch (see section on generating patches). + +

+
+
+-u +
+
+

+ Synonym for "-p". +

+
+
+-U<n> +
+
+

+ Shorthand for "--unified=<n>". +

+
+
+--unified=<n> +
+
+

+ Generate diffs with <n> lines of context instead of + the usual three. Implies "-p". +

+
+
+--raw +
+
+

+ Generate the raw format. + +

+
+
+--patch-with-raw +
+
+

+ Synonym for "-p --raw". +

+
+
+--stat[=width[,name-width]] +
+
+

+ Generate a diffstat. You can override the default + output width for 80-column terminal by "--stat=width". + The width of the filename part can be controlled by + giving another width to it separated by a comma. +

+
+
+--numstat +
+
+

+ Similar to --stat, but shows number of added and + deleted lines in decimal notation and pathname without + abbreviation, to make it more machine friendly. For + binary files, outputs two - instead of saying + 0 0. +

+
+
+--shortstat +
+
+

+ Output only the last line of the --stat format containing total + number of modified files, as well as number of added and deleted + lines. +

+
+
+--summary +
+
+

+ Output a condensed summary of extended header information + such as creations, renames and mode changes. +

+
+
+--patch-with-stat +
+
+

+ Synonym for "-p --stat". + +

+
+
+-z +
+
+

+ NUL-line termination on output. This affects the --raw + output field terminator. Also output from commands such + as "git-log" will be delimited with NUL between commits. +

+
+
+--name-only +
+
+

+ Show only names of changed files. +

+
+
+--name-status +
+
+

+ Show only names and status of changed files. +

+
+
+--color +
+
+

+ Show colored diff. +

+
+
+--no-color +
+
+

+ Turn off colored diff, even when the configuration file + gives the default to color output. +

+
+
+--color-words +
+
+

+ Show colored word diff, i.e. color words which have changed. +

+
+
+--no-renames +
+
+

+ Turn off rename detection, even when the configuration + file gives the default to do so. +

+
+
+--check +
+
+

+ Warn if changes introduce trailing whitespace + or an indent that uses a space before a tab. +

+
+
+--full-index +
+
+

+ Instead of the first handful characters, show full + object name of pre- and post-image blob on the "index" + line when generating a patch format output. +

+
+
+--binary +
+
+

+ In addition to --full-index, output "binary diff" that + can be applied with "git apply". +

+
+
+--abbrev[=<n>] +
+
+

+ Instead of showing the full 40-byte hexadecimal object + name in diff-raw format output and diff-tree header + lines, show only handful hexdigits prefix. This is + independent of --full-index option above, which controls + the diff-patch output format. Non default number of + digits can be specified with --abbrev=<n>. +

+
+
+-B +
+
+

+ Break complete rewrite changes into pairs of delete and create. +

+
+
+-M +
+
+

+ Detect renames. +

+
+
+-C +
+
+

+ Detect copies as well as renames. See also --find-copies-harder. +

+
+
+--diff-filter=[ACDMRTUXB*] +
+
+

+ Select only files that are Added (A), Copied (C), + Deleted (D), Modified (M), Renamed (R), have their + type (mode) changed (T), are Unmerged (U), are + Unknown (X), or have had their pairing Broken (B). + Any combination of the filter characters may be used. + When * (All-or-none) is added to the combination, all + paths are selected if there is any file that matches + other criteria in the comparison; if there is no file + that matches other criteria, nothing is selected. +

+
+
+--find-copies-harder +
+
+

+ For performance reasons, by default, -C option finds copies only + if the original file of the copy was modified in the same + changeset. This flag makes the command + inspect unmodified files as candidates for the source of + copy. This is a very expensive operation for large + projects, so use it with caution. Giving more than one + -C option has the same effect. +

+
+
+-l<num> +
+
+

+ -M and -C options require O(n^2) processing time where n + is the number of potential rename/copy targets. This + option prevents rename/copy detection from running if + the number of rename/copy targets exceeds the specified + number. +

+
+
+-S<string> +
+
+

+ Look for differences that contain the change in <string>. +

+
+
+--pickaxe-all +
+
+

+ When -S finds a change, show all the changes in that + changeset, not just the files that contain the change + in <string>. +

+
+
+--pickaxe-regex +
+
+

+ Make the <string> not a plain string but an extended POSIX + regex to match. +

+
+
+-O<orderfile> +
+
+

+ Output the patch in the order specified in the + <orderfile>, which has one shell glob pattern per line. +

+
+
+-R +
+
+

+ Swap two inputs; that is, show differences from index or + on-disk file to tree contents. +

+
+
+--text +
+
+

+ Treat all files as text. +

+
+
+-a +
+
+

+ Shorthand for "--text". +

+
+
+--ignore-space-at-eol +
+
+

+ Ignore changes in white spaces at EOL. +

+
+
+--ignore-space-change +
+
+

+ Ignore changes in amount of white space. This ignores white + space at line end, and consider all other sequences of one or + more white space characters to be equivalent. +

+
+
+-b +
+
+

+ Shorthand for "--ignore-space-change". +

+
+
+--ignore-all-space +
+
+

+ Ignore white space when comparing lines. This ignores + difference even if one line has white space where the other + line has none. +

+
+
+-w +
+
+

+ Shorthand for "--ignore-all-space". +

+
+
+--exit-code +
+
+

+ Make the program exit with codes similar to diff(1). + That is, it exits with 1 if there were differences and + 0 means no differences. +

+
+
+--quiet +
+
+

+ Disable all output of the program. Implies --exit-code. +

+
+
+--ext-diff +
+
+

+ Allow an external diff helper to be executed. If you set an + external diff driver with gitattributes(5), you need + to use this option with git-log(1) and friends. +

+
+
+--no-ext-diff +
+
+

+ Disallow external diff drivers. +

+
+
+

For more detailed explanation on these common options, see also +diffcore documentation.

+
-<n>
@@ -354,14 +770,6 @@ people using 80-column terminals.

--p -
-
-

- Show the change the commit introduces in a patch form. -

-
-
-g, --walk-reflogs
@@ -712,6 +1120,192 @@ The title was >>t4119: test autocomputing -p<n> for traditional diff
+

Generating patches with -p

+
+

When "git-diff-index", "git-diff-tree", or "git-diff-files" are run +with a -p option, "git diff" without the --raw option, or +"git log" with the "-p" option, they +do not produce the output described above; instead they produce a +patch file. You can customize the creation of such patches via the +GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.

+

What the -p option produces is slightly different from the traditional +diff format.

+
    +
  1. +

    +It is preceded with a "git diff" header, that looks like + this: +

    +
    +
    +
    diff --git a/file1 b/file2
    +
    +

    The a/ and b/ filenames are the same unless rename/copy is +involved. Especially, even for a creation or a deletion, +/dev/null is _not_ used in place of a/ or b/ filenames.

    +

    When rename/copy is involved, file1 and file2 show the +name of the source file of the rename/copy and the name of +the file that rename/copy produces, respectively.

    +
  2. +
  3. +

    +It is followed by one or more extended header lines: +

    +
    +
    +
    old mode <mode>
    +new mode <mode>
    +deleted file mode <mode>
    +new file mode <mode>
    +copy from <path>
    +copy to <path>
    +rename from <path>
    +rename to <path>
    +similarity index <number>
    +dissimilarity index <number>
    +index <hash>..<hash> <mode>
    +
    +
  4. +
  5. +

    +TAB, LF, double quote and backslash characters in pathnames + are represented as \t, \n, \" and \\, respectively. + If there is need for such substitution then the whole + pathname is put in double quotes. +

    +
  6. +
+

The similarity index is the percentage of unchanged lines, and +the dissimilarity index is the percentage of changed lines. It +is a rounded down integer, followed by a percent sign. The +similarity index value of 100% is thus reserved for two equal +files, while 100% dissimilarity means that no line from the old +file made it into the new one.

+
+

combined diff format

+
+

"git-diff-tree", "git-diff-files" and "git-diff" can take -c or +--cc option to produce combined diff. For showing a merge commit +with "git log -p", this is the default format. +A combined diff format looks like this:

+
+
+
diff --combined describe.c
+index fabadb8,cc95eb0..4866510
+--- a/describe.c
++++ b/describe.c
+@@@ -98,20 -98,12 +98,20 @@@
+        return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
+  }
+
+- static void describe(char *arg)
+ -static void describe(struct commit *cmit, int last_one)
+++static void describe(char *arg, int last_one)
+  {
+ +      unsigned char sha1[20];
+ +      struct commit *cmit;
+        struct commit_list *list;
+        static int initialized = 0;
+        struct commit_name *n;
+
+ +      if (get_sha1(arg, sha1) < 0)
+ +              usage(describe_usage);
+ +      cmit = lookup_commit_reference(sha1);
+ +      if (!cmit)
+ +              usage(describe_usage);
+ +
+        if (!initialized) {
+                initialized = 1;
+                for_each_ref(get_name);
+
+
    +
  1. +

    +It is preceded with a "git diff" header, that looks like + this (when -c option is used): +

    +
    +
    +
    diff --combined file
    +
    +

    or like this (when --cc option is used):

    +
    +
    +
    diff --c file
    +
    +
  2. +
  3. +

    +It is followed by one or more extended header lines + (this example shows a merge with two parents): +

    +
    +
    +
    index <hash>,<hash>..<hash>
    +mode <mode>,<mode>..<mode>
    +new file mode <mode>
    +deleted file mode <mode>,<mode>
    +
    +

    The mode <mode>,<mode>..<mode> line appears only if at least one of +the <mode> is different from the rest. Extended headers with +information about detected contents movement (renames and +copying detection) are designed to work with diff of two +<tree-ish> and are not used by combined diff format.

    +
  4. +
  5. +

    +It is followed by two-line from-file/to-file header +

    +
    +
    +
    --- a/file
    ++++ b/file
    +
    +

    Similar to two-line header for traditional unified diff +format, /dev/null is used to signal created or deleted +files.

    +
  6. +
  7. +

    +Chunk header format is modified to prevent people from + accidentally feeding it to patch -p1. Combined diff format + was created for review of merge commit changes, and was not + meant for apply. The change is similar to the change in the + extended index header: +

    +
    +
    +
    @@@ <from-file-range> <from-file-range> <to-file-range> @@@
    +
    +

    There are (number of parents + 1) @ characters in the chunk +header for combined diff format.

    +
  8. +
+

Unlike the traditional unified diff format, which shows two +files A and B with a single column that has - (minus — +appears in A but removed in B), + (plus — missing in A but +added to B), or " " (space — unchanged) prefix, this format +compares two or more files file1, file2,… with one file X, and +shows how X differs from each of fileN. One column for each of +fileN is prepended to the output line to note how X's line is +different from it.

+

A - character in the column N means that the line appears in +fileN but it does not appear in the result. A + character +in the column N means that the line appears in the last file, +and fileN does not have that line (in other words, the line was +added, from the point of view of that parent).

+

In the above example output, the function signature was changed +from both files (hence two - removals from both file1 and +file2, plus ++ to mean one line that was added does not appear +in either file1 nor file2). Also two other lines are the same +from file1 but do not appear in file2 (hence prefixed with +).

+

When shown by git diff-tree -c, it compares the parents of a +merge commit with the merge result (i.e. file1..fileN are the +parents). When shown by git diff-files -c, it compares the +two unresolved merge parents with the working tree file +(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka +"their version").

+

Examples

@@ -853,7 +1447,7 @@ reversible operation.

diff --git a/git-log.txt b/git-log.txt index 5ec547cc0..5920d1799 100644 --- a/git-log.txt +++ b/git-log.txt @@ -27,6 +27,9 @@ OPTIONS include::pretty-options.txt[] +:git-log: 1 +include::diff-options.txt[] + -:: Limits the number of commits to show. @@ -43,9 +46,6 @@ include::pretty-options.txt[] commit. This option gives a better overview of the evolution of a particular branch. --p:: - Show the change the commit introduces in a patch form. - -g, \--walk-reflogs:: Show commits as they were recorded in the reflog. The log contains a record about how the tip of a reference was changed. @@ -78,6 +78,7 @@ include::pretty-options.txt[] include::pretty-formats.txt[] +include::diff-generate-patch.txt[] Examples -------- diff --git a/git-status.html b/git-status.html index 4cc94edc2..fa89d1cf9 100644 --- a/git-status.html +++ b/git-status.html @@ -299,6 +299,9 @@ contains many paths that have been touched but not modified.

The output from this command is designed to be used as a commit template comments, and all the output lines are prefixed with #.

+

The paths mentioned in the output, unlike many other git commands, are +made relative to the current directory, if you are working in a +subdirectory (this is on purpose, to help cutting and pasting).

CONFIGURATION

@@ -326,7 +329,7 @@ Junio C Hamano <junkio@cox.net>.

diff --git a/git-status.txt b/git-status.txt index 8fd0fc623..b0cb6bc8b 100644 --- a/git-status.txt +++ b/git-status.txt @@ -40,6 +40,10 @@ OUTPUT The output from this command is designed to be used as a commit template comments, and all the output lines are prefixed with '#'. +The paths mentioned in the output, unlike many other git commands, are +made relative to the current directory, if you are working in a +subdirectory (this is on purpose, to help cutting and pasting). + CONFIGURATION -------------