blob: 0e45b58d8332cc9f48e0e18165f536adb94a5c6f [file] [log] [blame]
David Greaves2cf565c2005-05-10 22:32:30 +01001git-diff-tree(1)
2================
David Greaves2cf565c2005-05-10 22:32:30 +01003
4NAME
5----
6git-diff-tree - Compares the content and mode of blobs found via two tree objects
7
8
9SYNOPSIS
10--------
Jonas Fonseca353ce812005-12-31 18:37:15 +010011[verse]
Jonathan Niederb1889c32008-06-30 01:09:04 -050012'git diff-tree' [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]
Junio C Hamano34801ca2006-01-28 02:19:22 -080013 [-t] [-r] [-c | --cc] [--root] [<common diff options>]
14 <tree-ish> [<tree-ish>] [<path>...]
David Greaves2cf565c2005-05-10 22:32:30 +010015
16DESCRIPTION
17-----------
18Compares the content and mode of the blobs found via two tree objects.
19
Robert Watsonff8489c2005-09-23 11:06:04 +010020If there is only one <tree-ish> given, the commit is compared with its parents
21(see --stdin below).
22
Jonathan Niederba020ef2008-07-03 00:41:41 -050023Note that 'git-diff-tree' can use the tree encapsulated in a commit object.
David Greaves2cf565c2005-05-10 22:32:30 +010024
25OPTIONS
26-------
Junio C Hamanodda2d792005-07-13 12:52:35 -070027include::diff-options.txt[]
28
David Greaves2cf565c2005-05-10 22:32:30 +010029<tree-ish>::
30 The id of a tree object.
31
Junio C Hamano232b75a2005-06-19 13:14:53 -070032<path>...::
David Greaves2cf565c2005-05-10 22:32:30 +010033 If provided, the results are limited to a subset of files
34 matching one of these prefix strings.
Horst H. von Brandabda1ef2006-06-03 16:27:26 -040035 i.e., file matches `/^<pattern1>|<pattern2>|.../`
Junio C Hamano232b75a2005-06-19 13:14:53 -070036 Note that this parameter does not provide any wildcard or regexp
David Greaves2cf565c2005-05-10 22:32:30 +010037 features.
38
Chris Shoemaker50b8e352005-10-28 13:04:49 -040039-r::
40 recurse into sub-trees
41
Junio C Hamano4cae1a92005-05-24 23:24:22 -070042-t::
43 show tree entry itself as well as subtrees. Implies -r.
44
Thomas Glanzmann0746b622005-05-28 16:42:17 +020045--root::
46 When '--root' is specified the initial commit will be showed as a big
47 creation event. This is equivalent to a diff against the NULL tree.
48
David Greaves2cf565c2005-05-10 22:32:30 +010049--stdin::
50 When '--stdin' is specified, the command does not take
51 <tree-ish> arguments from the command line. Instead, it
52 reads either one <commit> or a pair of <tree-ish>
53 separated with a single space from its standard input.
54+
55When a single commit is given on one line of such input, it compares
56the commit with its parents. The following flags further affects its
Horst H. von Brandabda1ef2006-06-03 16:27:26 -040057behavior. This does not apply to the case where two <tree-ish>
David Greaves2cf565c2005-05-10 22:32:30 +010058separated with a single space are given.
59
60-m::
Jonathan Niederba020ef2008-07-03 00:41:41 -050061 By default, 'git-diff-tree --stdin' does not show
David Greaves2cf565c2005-05-10 22:32:30 +010062 differences for merge commits. With this flag, it shows
Petr Baudisa13ba122006-04-09 15:43:17 +020063 differences to that commit from all of its parents. See
64 also '-c'.
David Greaves2cf565c2005-05-10 22:32:30 +010065
66-s::
Jonathan Niederba020ef2008-07-03 00:41:41 -050067 By default, 'git-diff-tree --stdin' shows differences,
David Greaves2cf565c2005-05-10 22:32:30 +010068 either in machine-readable form (without '-p') or in patch
Junio C Hamano89438672005-12-29 01:20:06 -080069 form (with '-p'). This output can be suppressed. It is
David Greaves2cf565c2005-05-10 22:32:30 +010070 only useful with '-v' flag.
71
72-v::
Jonathan Niederba020ef2008-07-03 00:41:41 -050073 This flag causes 'git-diff-tree --stdin' to also show
David Greaves2cf565c2005-05-10 22:32:30 +010074 the commit message before the differences.
75
Jakub Narebski331b51d2007-05-14 01:25:45 +020076include::pretty-options.txt[]
Junio C Hamano232b75a2005-06-19 13:14:53 -070077
Pavel Roskin601c9782005-11-10 00:30:12 -050078--no-commit-id::
Jonathan Niederba020ef2008-07-03 00:41:41 -050079 'git-diff-tree' outputs a line with the commit ID when
Pavel Roskin601c9782005-11-10 00:30:12 -050080 applicable. This flag suppressed the commit ID output.
81
Petr Baudisa13ba122006-04-09 15:43:17 +020082-c::
83 This flag changes the way a merge commit is displayed
Junio C Hamano34801ca2006-01-28 02:19:22 -080084 (which means it is useful only when the command is given
85 one <tree-ish>, or '--stdin'). It shows the differences
Petr Baudisa13ba122006-04-09 15:43:17 +020086 from each of the parents to the merge result simultaneously
87 instead of showing pairwise diff between a parent and the
88 result one at a time (which is what the '-m' option does).
89 Furthermore, it lists only files which were modified
90 from all parents.
91
Matthias Kestenholzde5f2bf2006-05-03 12:51:40 +020092--cc::
Petr Baudisa13ba122006-04-09 15:43:17 +020093 This flag changes the way a merge commit patch is displayed,
94 in a similar way to the '-c' option. It implies the '-c'
95 and '-p' options and further compresses the patch output
96 by omitting hunks that show differences from only one
Junio C Hamano34801ca2006-01-28 02:19:22 -080097 parent, or show the same change from all but one parent
98 for an Octopus merge. When this optimization makes all
99 hunks disappear, the commit itself and the commit log
Petr Baudisa13ba122006-04-09 15:43:17 +0200100 message is not shown, just like in any other "empty diff" case.
Junio C Hamano34801ca2006-01-28 02:19:22 -0800101
Petr Baudis39048482006-02-07 12:47:44 +0100102--always::
103 Show the commit itself and the commit log message even
104 if the diff itself is empty.
105
David Greaves2cf565c2005-05-10 22:32:30 +0100106
Jakub Narebski331b51d2007-05-14 01:25:45 +0200107include::pretty-formats.txt[]
108
109
David Greaves2cf565c2005-05-10 22:32:30 +0100110Limiting Output
111---------------
112If you're only interested in differences in a subset of files, for
113example some architecture-specific files, you might do:
114
Jonathan Niederb1889c32008-06-30 01:09:04 -0500115 git diff-tree -r <tree-ish> <tree-ish> arch/ia64 include/asm-ia64
David Greaves2cf565c2005-05-10 22:32:30 +0100116
117and it will only show you what changed in those two directories.
118
119Or if you are searching for what changed in just `kernel/sched.c`, just do
120
Jonathan Niederb1889c32008-06-30 01:09:04 -0500121 git diff-tree -r <tree-ish> <tree-ish> kernel/sched.c
David Greaves2cf565c2005-05-10 22:32:30 +0100122
123and it will ignore all differences to other files.
124
125The pattern is always the prefix, and is matched exactly. There are no
Johannes Schindelin2c6e4772005-08-05 17:05:02 +0200126wildcards. Even stricter, it has to match a complete path component.
David Greaves2cf565c2005-05-10 22:32:30 +0100127I.e. "foo" does not pick up `foobar.h`. "foo" does match `foo/bar.h`
128so it can be used to name subdirectories.
129
130An example of normal usage is:
131
Jonathan Niederb1889c32008-06-30 01:09:04 -0500132 torvalds@ppc970:~/git> git diff-tree 5319e4......
Junio C Hamano215a7ad2005-09-07 17:26:23 -0700133 *100664->100664 blob ac348b.......->a01513....... git-fsck-objects.c
David Greaves2cf565c2005-05-10 22:32:30 +0100134
135which tells you that the last commit changed just one file (it's from
136this one:
137
Jonas Fonsecadf8baa42005-10-03 19:16:30 +0200138-----------------------------------------------------------------------------
139commit 3c6f7ca19ad4043e9e72fa94106f352897e651a8
140tree 5319e4d609cdd282069cc4dce33c1db559539b03
141parent b4e628ea30d5ab3606119d2ea5caeab141d38df7
142author Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005
143committer Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005
David Greaves2cf565c2005-05-10 22:32:30 +0100144
Jonas Fonsecadf8baa42005-10-03 19:16:30 +0200145Make "git-fsck-objects" print out all the root commits it finds.
David Greaves2cf565c2005-05-10 22:32:30 +0100146
Jonas Fonsecadf8baa42005-10-03 19:16:30 +0200147Once I do the reference tracking, I'll also make it print out all the
148HEAD commits it finds, which is even more interesting.
149-----------------------------------------------------------------------------
David Greaves2cf565c2005-05-10 22:32:30 +0100150
151in case you care).
152
153Output format
154-------------
155include::diff-format.txt[]
156
157
158Author
159------
160Written by Linus Torvalds <torvalds@osdl.org>
161
162Documentation
163--------------
164Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
165
166GIT
167---
Christian Couder9e1f0a82008-06-06 09:07:32 +0200168Part of the linkgit:git[1] suite