]>
Commit | Line | Data |
---|---|---|
2cf565c5 DG |
1 | git-diff-tree(1) |
2 | ================ | |
2cf565c5 DG |
3 | |
4 | NAME | |
5 | ---- | |
6 | git-diff-tree - Compares the content and mode of blobs found via two tree objects | |
7 | ||
8 | ||
9 | SYNOPSIS | |
10 | -------- | |
353ce815 | 11 | [verse] |
b1889c36 | 12 | 'git diff-tree' [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty] |
d76ce4f7 EN |
13 | [-t] [-r] [-c | --cc] [--combined-all-paths] [--root] |
14 | [<common diff options>] <tree-ish> [<tree-ish>] [<path>...] | |
2cf565c5 DG |
15 | |
16 | DESCRIPTION | |
17 | ----------- | |
18 | Compares the content and mode of the blobs found via two tree objects. | |
19 | ||
ff8489cb RW |
20 | If there is only one <tree-ish> given, the commit is compared with its parents |
21 | (see --stdin below). | |
22 | ||
0b444cdb | 23 | Note that 'git diff-tree' can use the tree encapsulated in a commit object. |
2cf565c5 DG |
24 | |
25 | OPTIONS | |
26 | ------- | |
dda2d79a JH |
27 | include::diff-options.txt[] |
28 | ||
2cf565c5 DG |
29 | <tree-ish>:: |
30 | The id of a tree object. | |
31 | ||
232b75ab | 32 | <path>...:: |
2cf565c5 | 33 | If provided, the results are limited to a subset of files |
9fce19a4 | 34 | matching one of the provided pathspecs. |
2cf565c5 | 35 | |
50b8e355 CS |
36 | -r:: |
37 | recurse into sub-trees | |
38 | ||
4cae1a96 JH |
39 | -t:: |
40 | show tree entry itself as well as subtrees. Implies -r. | |
41 | ||
0746b620 | 42 | --root:: |
bcf9626a | 43 | When `--root` is specified the initial commit will be shown as a big |
0746b620 TG |
44 | creation event. This is equivalent to a diff against the NULL tree. |
45 | ||
2cf565c5 | 46 | --stdin:: |
bcf9626a | 47 | When `--stdin` is specified, the command does not take |
2cf565c5 | 48 | <tree-ish> arguments from the command line. Instead, it |
140b378d KW |
49 | reads lines containing either two <tree>, one <commit>, or a |
50 | list of <commit> from its standard input. (Use a single space | |
51 | as separator.) | |
2cf565c5 | 52 | + |
140b378d | 53 | When two trees are given, it compares the first tree with the second. |
7cccfaa2 KW |
54 | When a single commit is given, it compares the commit with its |
55 | parents. The remaining commits, when given, are used as if they are | |
eabbc99a | 56 | parents of the first commit. |
7cccfaa2 | 57 | + |
140b378d KW |
58 | When comparing two trees, the ID of both trees (separated by a space |
59 | and terminated by a newline) is printed before the difference. When | |
60 | comparing commits, the ID of the first (or only) commit, followed by a | |
61 | newline, is printed. | |
7cccfaa2 | 62 | + |
5832d1a9 | 63 | The following flags further affect the behavior when comparing |
140b378d | 64 | commits (but not trees). |
2cf565c5 DG |
65 | |
66 | -m:: | |
0b444cdb | 67 | By default, 'git diff-tree --stdin' does not show |
2cf565c5 | 68 | differences for merge commits. With this flag, it shows |
a13ba129 | 69 | differences to that commit from all of its parents. See |
23f8239b | 70 | also `-c`. |
2cf565c5 DG |
71 | |
72 | -s:: | |
0b444cdb | 73 | By default, 'git diff-tree --stdin' shows differences, |
23f8239b MM |
74 | either in machine-readable form (without `-p`) or in patch |
75 | form (with `-p`). This output can be suppressed. It is | |
76 | only useful with `-v` flag. | |
2cf565c5 DG |
77 | |
78 | -v:: | |
0b444cdb | 79 | This flag causes 'git diff-tree --stdin' to also show |
2cf565c5 DG |
80 | the commit message before the differences. |
81 | ||
331b51d2 | 82 | include::pretty-options.txt[] |
232b75ab | 83 | |
601c978c | 84 | --no-commit-id:: |
0b444cdb | 85 | 'git diff-tree' outputs a line with the commit ID when |
601c978c PR |
86 | applicable. This flag suppressed the commit ID output. |
87 | ||
a13ba129 PB |
88 | -c:: |
89 | This flag changes the way a merge commit is displayed | |
34801cab | 90 | (which means it is useful only when the command is given |
bcf9626a | 91 | one <tree-ish>, or `--stdin`). It shows the differences |
a13ba129 PB |
92 | from each of the parents to the merge result simultaneously |
93 | instead of showing pairwise diff between a parent and the | |
23f8239b | 94 | result one at a time (which is what the `-m` option does). |
a13ba129 PB |
95 | Furthermore, it lists only files which were modified |
96 | from all parents. | |
97 | ||
de5f2bf3 | 98 | --cc:: |
a13ba129 | 99 | This flag changes the way a merge commit patch is displayed, |
23f8239b MM |
100 | in a similar way to the `-c` option. It implies the `-c` |
101 | and `-p` options and further compresses the patch output | |
ea3d988d JH |
102 | by omitting uninteresting hunks whose the contents in the parents |
103 | have only two variants and the merge result picks one of them | |
104 | without modification. When all hunks are uninteresting, the commit | |
105 | itself and the commit log message is not shown, just like in any other | |
106 | "empty diff" case. | |
34801cab | 107 | |
d76ce4f7 EN |
108 | --combined-all-paths:: |
109 | This flag causes combined diffs (used for merge commits) to | |
110 | list the name of the file from all parents. It thus only has | |
111 | effect when -c or --cc are specified, and is likely only | |
112 | useful if filename changes are detected (i.e. when either | |
113 | rename or copy detection have been requested). | |
114 | ||
3904848c PB |
115 | --always:: |
116 | Show the commit itself and the commit log message even | |
117 | if the diff itself is empty. | |
118 | ||
2cf565c5 | 119 | |
331b51d2 | 120 | include::pretty-formats.txt[] |
98228427 | 121 | |
2cf565c5 DG |
122 | include::diff-format.txt[] |
123 | ||
2cf565c5 DG |
124 | GIT |
125 | --- | |
9e1f0a85 | 126 | Part of the linkgit:git[1] suite |