git-diff-tree.txt 3.9 KB

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