Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 170 lines (129 sloc) 5.57 kb
f552e51 @dkagedal Update the documentation of the raw diff output format
dkagedal authored
1 Raw output format
2 -----------------
3
4 The raw output format from "git-diff-index", "git-diff-tree",
9e6c723 git-diff.txt: add section "output format" describing the diff formats
Gerrit Pape authored
5 "git-diff-files" and "git diff --raw" are very similar.
03ea280 @lbt [PATCH 2/2] core-git documentation update
lbt authored
6
a6080a0 @gitster War on whitespace
gitster authored
7 These commands all compare two sets of things; what is
f73ae1f Some typos and light editing of various manpages
Christian Meder authored
8 compared differs:
03ea280 @lbt [PATCH 2/2] core-git documentation update
lbt authored
9
215a7ad Big tool rename.
Junio C Hamano authored
10 git-diff-index <tree-ish>::
03ea280 @lbt [PATCH 2/2] core-git documentation update
lbt authored
11 compares the <tree-ish> and the files on the filesystem.
12
215a7ad Big tool rename.
Junio C Hamano authored
13 git-diff-index --cached <tree-ish>::
5f3aa19 Change 'cache' to 'index' in the docs
Lukas_Sandström authored
14 compares the <tree-ish> and the index.
03ea280 @lbt [PATCH 2/2] core-git documentation update
lbt authored
15
16 git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>...]::
17 compares the trees named by the two arguments.
18
19 git-diff-files [<pattern>...]::
5f3aa19 Change 'cache' to 'index' in the docs
Lukas_Sandström authored
20 compares the index and the files on the filesystem.
03ea280 @lbt [PATCH 2/2] core-git documentation update
lbt authored
21
6a5d0b0 Fix typos in technical documentation.
Ralf Wildenhues authored
22 The "git-diff-tree" command begins its output by printing the hash of
f552e51 @dkagedal Update the documentation of the raw diff output format
dkagedal authored
23 what is being compared. After that, all the commands print one output
24 line per changed file.
03ea280 @lbt [PATCH 2/2] core-git documentation update
lbt authored
25
81e50ea [PATCH] The diff-raw format updates.
Junio C Hamano authored
26 An output line is formatted this way:
03ea280 @lbt [PATCH 2/2] core-git documentation update
lbt authored
27
8db9307 Documentaion updates.
Junio C Hamano authored
28 ------------------------------------------------
b6d8f30 [PATCH] diff-raw format update take #2.
Junio C Hamano authored
29 in-place edit :100644 100644 bcd1234... 0123456... M file0
30 copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2
31 rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3
8db9307 Documentaion updates.
Junio C Hamano authored
32 create :000000 100644 0000000... 1234567... A file4
b6d8f30 [PATCH] diff-raw format update take #2.
Junio C Hamano authored
33 delete :100644 000000 1234567... 0000000... D file5
34 unmerged :000000 000000 0000000... 0000000... U file6
8db9307 Documentaion updates.
Junio C Hamano authored
35 ------------------------------------------------
b6d8f30 [PATCH] diff-raw format update take #2.
Junio C Hamano authored
36
37 That is, from the left to the right:
38
8db9307 Documentaion updates.
Junio C Hamano authored
39 . a colon.
40 . mode for "src"; 000000 if creation or unmerged.
41 . a space.
42 . mode for "dst"; 000000 if deletion or unmerged.
43 . a space.
44 . sha1 for "src"; 0\{40\} if creation or unmerged.
45 . a space.
46 . sha1 for "dst"; 0\{40\} if creation, unmerged or "look at work tree".
47 . a space.
48 . status, followed by optional "score" number.
49 . a tab or a NUL when '-z' option is used.
50 . path for "src"
51 . a tab or a NUL when '-z' option is used; only exists for C or R.
52 . path for "dst"; only exists for C or R.
53 . an LF or a NUL when '-z' option is used, to terminate the record.
03ea280 @lbt [PATCH 2/2] core-git documentation update
lbt authored
54
a5a323f @ydirson Add reference for status letters in documentation.
ydirson authored
55 Possible status letters are:
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
63 - U: file is unmerged (you must complete the merge before it can
64 be committed)
65 - X: "unknown" change type (most probably a bug, please report it)
66
04c8ce9 @marcows Documentation: fix typos, grammar, asciidoc syntax
marcows authored
67 Status letters C and R are always followed by a score (denoting the
a5a323f @ydirson Add reference for status letters in documentation.
ydirson authored
68 percentage of similarity between the source and target of the move or
69 copy), and are the only ones to be so.
70
f73ae1f Some typos and light editing of various manpages
Christian Meder authored
71 <sha1> is shown as all 0's if a file is new on the filesystem
5f3aa19 Change 'cache' to 'index' in the docs
Lukas_Sandström authored
72 and it is out of sync with the index.
03ea280 @lbt [PATCH 2/2] core-git documentation update
lbt authored
73
8db9307 Documentaion updates.
Junio C Hamano authored
74 Example:
75
76 ------------------------------------------------
77 :100644 100644 5be4a4...... 000000...... M file.c
78 ------------------------------------------------
03ea280 @lbt [PATCH 2/2] core-git documentation update
lbt authored
79
d88156e Update documentation for C-style quoting.
Junio C Hamano authored
80 When `-z` option is not used, TAB, LF, and backslash characters
81 in pathnames are represented as `\t`, `\n`, and `\\`,
82 respectively.
83
3b559ea @jnareb diff format documentation: describe raw combined diff format
jnareb authored
84 diff format for merges
85 ----------------------
86
9e6c723 git-diff.txt: add section "output format" describing the diff formats
Gerrit Pape authored
87 "git-diff-tree", "git-diff-files" and "git-diff --raw"
88 can take '-c' or '--cc' option
3b559ea @jnareb diff format documentation: describe raw combined diff format
jnareb authored
89 to generate diff output also for merge commits. The output differs
90 from the format described above in the following way:
91
92 . there is a colon for each parent
93 . there are more "src" modes and "src" sha1
94 . status is concatenated status characters for each parent
95 . no optional "score" number
96 . single path, only for "dst"
97
98 Example:
99
100 ------------------------------------------------
101 ::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c
102 ------------------------------------------------
103
104 Note that 'combined diff' lists only files which were modified from
105 all parents.
106
d88156e Update documentation for C-style quoting.
Junio C Hamano authored
107
272bd3c Include diff options in the git-log manpage
Miklos Vajna authored
108 include::diff-generate-patch.txt[]
f604652 @gitster git-diff --numstat -z: make it machine readable
gitster authored
109
110
111 other diff formats
112 ------------------
113
114 The `--summary` option describes newly added, deleted, renamed and
115 copied files. The `--stat` option adds diffstat(1) graph to the
116 output. These options can be combined with other options, such as
117 `-p`, and are meant for human consumption.
118
119 When showing a change that involves a rename or a copy, `--stat` output
120 formats the pathnames compactly by combining common prefix and suffix of
121 the pathnames. For example, a change that moves `arch/i386/Makefile` to
122 `arch/x86/Makefile` while modifying 4 lines will be shown like this:
123
124 ------------------------------------
125 arch/{i386 => x86}/Makefile | 4 +--
126 ------------------------------------
127
128 The `--numstat` option gives the diffstat(1) information but is designed
129 for easier machine consumption. An entry in `--numstat` output looks
130 like this:
131
132 ----------------------------------------
133 1 2 README
134 3 1 arch/{i386 => x86}/Makefile
135 ----------------------------------------
136
137 That is, from left to right:
138
139 . the number of added lines;
140 . a tab;
141 . the number of deleted lines;
142 . a tab;
143 . pathname (possibly with rename/copy information);
144 . a newline.
145
146 When `-z` output option is in effect, the output is formatted this way:
147
148 ----------------------------------------
149 1 2 README NUL
150 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL
151 ----------------------------------------
152
153 That is:
154
155 . the number of added lines;
156 . a tab;
157 . the number of deleted lines;
158 . a tab;
159 . a NUL (only exists if renamed/copied);
160 . pathname in preimage;
161 . a NUL (only exists if renamed/copied);
162 . pathname in postimage (only exists if renamed/copied);
163 . a NUL.
164
165 The extra `NUL` before the preimage path in renamed case is to allow
166 scripts that read the output to tell if the current record being read is
167 a single-path record or a rename/copy record without reading ahead.
168 After reading added and deleted lines, reading up to `NUL` would yield
169 the pathname, but if that is `NUL`, the record will show two paths.
Something went wrong with that request. Please try again.