Home Explore Blog CI



git

2nd chunk of `Documentation/diff-format.adoc`
49034eb88124bbfdc749f0ef197e5dcdd1b1423b0c3c8d150000000100000894
 report it)

Status letters `C` and `R` are always followed by a score (denoting the
percentage of similarity between the source and target of the move or
copy).  Status letter `M` may be followed by a score (denoting the
percentage of dissimilarity) for file rewrites.

The sha1 for "dst" is shown as all 0's if a file on the filesystem
is out of sync with the index.

Example:

------------------------------------------------
:100644 100644 5be4a4a 0000000 M file.c
------------------------------------------------

Without the `-z` option, pathnames with "unusual" characters are
quoted as explained for the configuration variable `core.quotePath`
(see linkgit:git-config[1]).  Using `-z` the filename is output
verbatim and the line is terminated by a NUL byte.

diff format for merges
----------------------

`git-diff-tree`, `git-diff-files` and `git-diff --raw`
can take `-c` or `--cc` option
to generate diff output also for merge commits.  The output differs
from the format described above in the following way:

. there is a colon for each parent
. there are more "src" modes and "src" sha1
. status is concatenated status characters for each parent
. no optional "score" number
. tab-separated pathname(s) of the file

For `-c` and `--cc`, only the destination or final path is shown even
if the file was renamed on any side of history.  With
`--combined-all-paths`, the name of the path in each parent is shown
followed by the name of the path in the merge commit.

Examples for `-c` and `--cc` without `--combined-all-paths`:
------------------------------------------------
::100644 100644 100644 fabadb8 cc95eb0 4866510 MM	desc.c
::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM	bar.sh
::100644 100644 100644 e07d6c5 9042e82 ee91881 RR	phooey.c
------------------------------------------------

Examples when `--combined-all-paths` added to either `-c` or `--cc`:

------------------------------------------------
::100644 100644 100644 fabadb8 cc95eb0 4866510 MM	desc.c	desc.c	desc.c
::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM	foo.sh	bar.sh	bar.sh
::100644 100644 100644 e07d6c5 9042e82 ee91881 RR	fooey.c	fuey.c	phooey.c
------------------------------------------------

Title: Git Diff Format for Merges
Summary
The diff format for merge commits in Git is explained, including the output format for options `-c` and `--cc`, and how the `--combined-all-paths` option affects the output, with examples provided to illustrate the different formats.