logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

git-diff-tree.1 (82331B)


  1. '\" t
  2. .\" Title: git-diff-tree
  3. .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
  4. .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
  5. .\" Date: 2025-03-14
  6. .\" Manual: Git Manual
  7. .\" Source: Git 2.49.0
  8. .\" Language: English
  9. .\"
  10. .TH "GIT\-DIFF\-TREE" "1" "2025-03-14" "Git 2\&.49\&.0" "Git Manual"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. git-diff-tree \- Compares the content and mode of blobs found via two tree objects
  32. .SH "SYNOPSIS"
  33. .sp
  34. .nf
  35. \fIgit diff\-tree\fR [\-\-stdin] [\-m] [\-s] [\-v] [\-\-no\-commit\-id] [\-\-pretty]
  36. [\-t] [\-r] [\-c | \-\-cc] [\-\-combined\-all\-paths] [\-\-root] [\-\-merge\-base]
  37. [<common\-diff\-options>] <tree\-ish> [<tree\-ish>] [<path>\&...\:]
  38. .fi
  39. .SH "DESCRIPTION"
  40. .sp
  41. Compare the content and mode of blobs found via two tree objects\&.
  42. .sp
  43. If there is only one <tree\-ish> given, the commit is compared with its parents (see \-\-stdin below)\&.
  44. .sp
  45. Note that \fIgit diff\-tree\fR can use the tree encapsulated in a commit object\&.
  46. .SH "OPTIONS"
  47. .PP
  48. \fB\-p\fR, \fB\-u\fR, \fB\-\-patch\fR
  49. .RS 4
  50. Generate patch (see
  51. the section called \(lqGENERATING PATCH TEXT WITH \-P\(rq)\&.
  52. .RE
  53. .PP
  54. \fB\-s\fR, \fB\-\-no\-patch\fR
  55. .RS 4
  56. Suppress all output from the diff machinery\&. Useful for commands like
  57. \fBgit\fR
  58. \fBshow\fR
  59. that show the patch by default to squelch their output, or to cancel the effect of options like
  60. \fB\-\-patch\fR,
  61. \fB\-\-stat\fR
  62. earlier on the command line in an alias\&.
  63. .RE
  64. .PP
  65. \fB\-U\fR\fI<n>\fR, \fB\-\-unified=\fR\fI<n>\fR
  66. .RS 4
  67. Generate diffs with
  68. \fI<n>\fR
  69. lines of context instead of the usual three\&. Implies
  70. \fB\-\-patch\fR\&.
  71. .RE
  72. .PP
  73. \fB\-\-output=\fR\fI<file>\fR
  74. .RS 4
  75. Output to a specific file instead of stdout\&.
  76. .RE
  77. .PP
  78. \fB\-\-output\-indicator\-new=\fR\fI<char>\fR, \fB\-\-output\-indicator\-old=\fR\fI<char>\fR, \fB\-\-output\-indicator\-context=\fR\fI<char>\fR
  79. .RS 4
  80. Specify the character used to indicate new, old or context lines in the generated patch\&. Normally they are
  81. \fB+\fR,
  82. \fB\-\fR
  83. and \*(Aq \*(Aq respectively\&.
  84. .RE
  85. .PP
  86. \fB\-\-raw\fR
  87. .RS 4
  88. Generate the diff in raw format\&. This is the default\&.
  89. .RE
  90. .PP
  91. \fB\-\-patch\-with\-raw\fR
  92. .RS 4
  93. Synonym for
  94. \fB\-p\fR
  95. \fB\-\-raw\fR\&.
  96. .RE
  97. .PP
  98. \fB\-\-indent\-heuristic\fR
  99. .RS 4
  100. Enable the heuristic that shifts diff hunk boundaries to make patches easier to read\&. This is the default\&.
  101. .RE
  102. .PP
  103. \fB\-\-no\-indent\-heuristic\fR
  104. .RS 4
  105. Disable the indent heuristic\&.
  106. .RE
  107. .PP
  108. \fB\-\-minimal\fR
  109. .RS 4
  110. Spend extra time to make sure the smallest possible diff is produced\&.
  111. .RE
  112. .PP
  113. \fB\-\-patience\fR
  114. .RS 4
  115. Generate a diff using the "patience diff" algorithm\&.
  116. .RE
  117. .PP
  118. \fB\-\-histogram\fR
  119. .RS 4
  120. Generate a diff using the "histogram diff" algorithm\&.
  121. .RE
  122. .PP
  123. \fB\-\-anchored=\fR\fI<text>\fR
  124. .RS 4
  125. Generate a diff using the "anchored diff" algorithm\&.
  126. .sp
  127. This option may be specified more than once\&.
  128. .sp
  129. If a line exists in both the source and destination, exists only once, and starts with
  130. \fI<text>\fR, this algorithm attempts to prevent it from appearing as a deletion or addition in the output\&. It uses the "patience diff" algorithm internally\&.
  131. .RE
  132. .PP
  133. \fB\-\-diff\-algorithm=\fR(\fBpatience\fR|\fBminimal\fR|\fBhistogram\fR|\fBmyers\fR)
  134. .RS 4
  135. Choose a diff algorithm\&. The variants are as follows:
  136. .PP
  137. \fBdefault\fR, \fBmyers\fR
  138. .RS 4
  139. The basic greedy diff algorithm\&. Currently, this is the default\&.
  140. .RE
  141. .PP
  142. \fBminimal\fR
  143. .RS 4
  144. Spend extra time to make sure the smallest possible diff is produced\&.
  145. .RE
  146. .PP
  147. \fBpatience\fR
  148. .RS 4
  149. Use "patience diff" algorithm when generating patches\&.
  150. .RE
  151. .PP
  152. \fBhistogram\fR
  153. .RS 4
  154. This algorithm extends the patience algorithm to "support low\-occurrence common elements"\&.
  155. .RE
  156. .sp
  157. For instance, if you configured the
  158. \fBdiff\&.algorithm\fR
  159. variable to a non\-default value and want to use the default one, then you have to use
  160. \fB\-\-diff\-algorithm=default\fR
  161. option\&.
  162. .RE
  163. .PP
  164. \fB\-\-stat\fR[\fB=\fR\fI<width>\fR[\fB,\fR\fI<name\-width>\fR[\fB,\fR\fI<count>\fR]]]
  165. .RS 4
  166. Generate a diffstat\&. By default, as much space as necessary will be used for the filename part, and the rest for the graph part\&. Maximum width defaults to terminal width, or 80 columns if not connected to a terminal, and can be overridden by
  167. \fI<width>\fR\&. The width of the filename part can be limited by giving another width
  168. \fI<name\-width>\fR
  169. after a comma or by setting
  170. \fBdiff\&.statNameWidth=\fR\fI<name\-width>\fR\&. The width of the graph part can be limited by using
  171. \fB\-\-stat\-graph\-width=\fR\fI<graph\-width>\fR
  172. or by setting
  173. \fBdiff\&.statGraphWidth=\fR\fI<graph\-width>\fR\&. Using
  174. \fB\-\-stat\fR
  175. or
  176. \fB\-\-stat\-graph\-width\fR
  177. affects all commands generating a stat graph, while setting
  178. \fBdiff\&.statNameWidth\fR
  179. or
  180. \fBdiff\&.statGraphWidth\fR
  181. does not affect
  182. \fBgit\fR
  183. \fBformat\-patch\fR\&. By giving a third parameter
  184. \fI<count>\fR, you can limit the output to the first
  185. \fI<count>\fR
  186. lines, followed by \&.\&.\&. if there are more\&.
  187. .sp
  188. These parameters can also be set individually with
  189. \fB\-\-stat\-width=\fR\fI<width>\fR,
  190. \fB\-\-stat\-name\-width=\fR\fI<name\-width>\fR
  191. and
  192. \fB\-\-stat\-count=\fR\fI<count>\fR\&.
  193. .RE
  194. .PP
  195. \fB\-\-compact\-summary\fR
  196. .RS 4
  197. Output a condensed summary of extended header information such as file creations or deletions ("new" or "gone", optionally
  198. \fB+l\fR
  199. if it\(cqs a symlink) and mode changes (\fB+x\fR
  200. or
  201. \fB\-x\fR
  202. for adding or removing executable bit respectively) in diffstat\&. The information is put between the filename part and the graph part\&. Implies
  203. \fB\-\-stat\fR\&.
  204. .RE
  205. .PP
  206. \fB\-\-numstat\fR
  207. .RS 4
  208. Similar to
  209. \fB\-\-stat\fR, but shows number of added and deleted lines in decimal notation and pathname without abbreviation, to make it more machine friendly\&. For binary files, outputs two
  210. \fB\-\fR
  211. instead of saying
  212. \fB0\fR
  213. \fB0\fR\&.
  214. .RE
  215. .PP
  216. \fB\-\-shortstat\fR
  217. .RS 4
  218. Output only the last line of the
  219. \fB\-\-stat\fR
  220. format containing total number of modified files, as well as number of added and deleted lines\&.
  221. .RE
  222. .PP
  223. \fB\-X\fR [\fI<param>\fR\fB,\&.\&.\fR\&.], \fB\-\-dirstat\fR[\fB=\fR\fI<param>\fR\fB,\&.\&.\fR\&.]
  224. .RS 4
  225. Output the distribution of relative amount of changes for each sub\-directory\&. The behavior of
  226. \fB\-\-dirstat\fR
  227. can be customized by passing it a comma separated list of parameters\&. The defaults are controlled by the
  228. \fBdiff\&.dirstat\fR
  229. configuration variable (see
  230. \fBgit-config\fR(1))\&. The following parameters are available:
  231. .PP
  232. \fBchanges\fR
  233. .RS 4
  234. Compute the dirstat numbers by counting the lines that have been removed from the source, or added to the destination\&. This ignores the amount of pure code movements within a file\&. In other words, rearranging lines in a file is not counted as much as other changes\&. This is the default behavior when no parameter is given\&.
  235. .RE
  236. .PP
  237. \fBlines\fR
  238. .RS 4
  239. Compute the dirstat numbers by doing the regular line\-based diff analysis, and summing the removed/added line counts\&. (For binary files, count 64\-byte chunks instead, since binary files have no natural concept of lines)\&. This is a more expensive
  240. \fB\-\-dirstat\fR
  241. behavior than the
  242. \fBchanges\fR
  243. behavior, but it does count rearranged lines within a file as much as other changes\&. The resulting output is consistent with what you get from the other
  244. \fB\-\-\fR*stat options\&.
  245. .RE
  246. .PP
  247. \fBfiles\fR
  248. .RS 4
  249. Compute the dirstat numbers by counting the number of files changed\&. Each changed file counts equally in the dirstat analysis\&. This is the computationally cheapest
  250. \fB\-\-dirstat\fR
  251. behavior, since it does not have to look at the file contents at all\&.
  252. .RE
  253. .PP
  254. \fBcumulative\fR
  255. .RS 4
  256. Count changes in a child directory for the parent directory as well\&. Note that when using
  257. \fBcumulative\fR, the sum of the percentages reported may exceed 100%\&. The default (non\-cumulative) behavior can be specified with the
  258. \fBnoncumulative\fR
  259. parameter\&.
  260. .RE
  261. .PP
  262. \fI<limit>\fR
  263. .RS 4
  264. An integer parameter specifies a cut\-off percent (3% by default)\&. Directories contributing less than this percentage of the changes are not shown in the output\&.
  265. .RE
  266. .sp
  267. Example: The following will count changed files, while ignoring directories with less than 10% of the total amount of changed files, and accumulating child directory counts in the parent directories:
  268. \fB\-\-dirstat=files,10,cumulative\fR\&.
  269. .RE
  270. .PP
  271. \fB\-\-cumulative\fR
  272. .RS 4
  273. Synonym for
  274. \fB\-\-dirstat=cumulative\fR\&.
  275. .RE
  276. .PP
  277. \fB\-\-dirstat\-by\-file\fR[\fB=\fR\fI<param>\fR\fB,\&.\&.\fR\&.]
  278. .RS 4
  279. Synonym for
  280. \fB\-\-dirstat=files,\fR\fI<param>\fR\fB,\&.\&.\fR\&.\&.
  281. .RE
  282. .PP
  283. \fB\-\-summary\fR
  284. .RS 4
  285. Output a condensed summary of extended header information such as creations, renames and mode changes\&.
  286. .RE
  287. .PP
  288. \fB\-\-patch\-with\-stat\fR
  289. .RS 4
  290. Synonym for
  291. \fB\-p\fR
  292. \fB\-\-stat\fR\&.
  293. .RE
  294. .PP
  295. \fB\-z\fR
  296. .RS 4
  297. When
  298. \fB\-\-raw\fR,
  299. \fB\-\-numstat\fR,
  300. \fB\-\-name\-only\fR
  301. or
  302. \fB\-\-name\-status\fR
  303. has been given, do not munge pathnames and use NULs as output field terminators\&.
  304. .sp
  305. Without this option, pathnames with "unusual" characters are quoted as explained for the configuration variable
  306. \fBcore\&.quotePath\fR
  307. (see
  308. \fBgit-config\fR(1))\&.
  309. .RE
  310. .PP
  311. \fB\-\-name\-only\fR
  312. .RS 4
  313. Show only the name of each changed file in the post\-image tree\&. The file names are often encoded in UTF\-8\&. For more information see the discussion about encoding in the
  314. \fBgit-log\fR(1)
  315. manual page\&.
  316. .RE
  317. .PP
  318. \fB\-\-name\-status\fR
  319. .RS 4
  320. Show only the name(s) and status of each changed file\&. See the description of the
  321. \fB\-\-diff\-filter\fR
  322. option on what the status letters mean\&. Just like
  323. \fB\-\-name\-only\fR
  324. the file names are often encoded in UTF\-8\&.
  325. .RE
  326. .PP
  327. \fB\-\-submodule\fR[\fB=\fR\fI<format>\fR]
  328. .RS 4
  329. Specify how differences in submodules are shown\&. When specifying
  330. \fB\-\-submodule=short\fR
  331. the
  332. \fBshort\fR
  333. format is used\&. This format just shows the names of the commits at the beginning and end of the range\&. When
  334. \fB\-\-submodule\fR
  335. or
  336. \fB\-\-submodule=log\fR
  337. is specified, the
  338. \fBlog\fR
  339. format is used\&. This format lists the commits in the range like
  340. \fBgit-submodule\fR(1)
  341. \fBsummary\fR
  342. does\&. When
  343. \fB\-\-submodule=diff\fR
  344. is specified, the
  345. \fBdiff\fR
  346. format is used\&. This format shows an inline diff of the changes in the submodule contents between the commit range\&. Defaults to
  347. \fBdiff\&.submodule\fR
  348. or the
  349. \fBshort\fR
  350. format if the config option is unset\&.
  351. .RE
  352. .PP
  353. \fB\-\-color\fR[\fB=\fR\fI<when>\fR]
  354. .RS 4
  355. Show colored diff\&.
  356. \fB\-\-color\fR
  357. (i\&.e\&. without
  358. \fB=\fR\fI<when>\fR) is the same as
  359. \fB\-\-color=always\fR\&.
  360. \fI<when>\fR
  361. can be one of
  362. \fBalways\fR,
  363. \fBnever\fR, or
  364. \fBauto\fR\&.
  365. .RE
  366. .PP
  367. \fB\-\-no\-color\fR
  368. .RS 4
  369. Turn off colored diff\&. It is the same as
  370. \fB\-\-color=never\fR\&.
  371. .RE
  372. .PP
  373. \fB\-\-color\-moved\fR[\fB=\fR\fI<mode>\fR]
  374. .RS 4
  375. Moved lines of code are colored differently\&. The
  376. \fI<mode>\fR
  377. defaults to
  378. \fBno\fR
  379. if the option is not given and to
  380. \fBzebra\fR
  381. if the option with no mode is given\&. The mode must be one of:
  382. .PP
  383. \fBno\fR
  384. .RS 4
  385. Moved lines are not highlighted\&.
  386. .RE
  387. .PP
  388. \fBdefault\fR
  389. .RS 4
  390. Is a synonym for
  391. \fBzebra\fR\&. This may change to a more sensible mode in the future\&.
  392. .RE
  393. .PP
  394. \fBplain\fR
  395. .RS 4
  396. Any line that is added in one location and was removed in another location will be colored with
  397. \fBcolor\&.diff\&.newMoved\fR\&. Similarly
  398. \fBcolor\&.diff\&.oldMoved\fR
  399. will be used for removed lines that are added somewhere else in the diff\&. This mode picks up any moved line, but it is not very useful in a review to determine if a block of code was moved without permutation\&.
  400. .RE
  401. .PP
  402. \fBblocks\fR
  403. .RS 4
  404. Blocks of moved text of at least 20 alphanumeric characters are detected greedily\&. The detected blocks are painted using either the
  405. \fBcolor\&.diff\&.\fR(\fBold\fR|\fBnew\fR)\fBMoved\fR
  406. color\&. Adjacent blocks cannot be told apart\&.
  407. .RE
  408. .PP
  409. \fBzebra\fR
  410. .RS 4
  411. Blocks of moved text are detected as in
  412. \fBblocks\fR
  413. mode\&. The blocks are painted using either the
  414. \fBcolor\&.diff\&.\fR(\fBold\fR|\fBnew\fR)\fBMoved\fR
  415. color or
  416. \fBcolor\&.diff\&.\fR(\fBold\fR|\fBnew\fR)\fBMovedAlternative\fR\&. The change between the two colors indicates that a new block was detected\&.
  417. .RE
  418. .PP
  419. \fBdimmed\-zebra\fR
  420. .RS 4
  421. Similar to
  422. \fBzebra\fR, but additional dimming of uninteresting parts of moved code is performed\&. The bordering lines of two adjacent blocks are considered interesting, the rest is uninteresting\&.
  423. \fBdimmed_zebra\fR
  424. is a deprecated synonym\&.
  425. .RE
  426. .RE
  427. .PP
  428. \fB\-\-no\-color\-moved\fR
  429. .RS 4
  430. Turn off move detection\&. This can be used to override configuration settings\&. It is the same as
  431. \fB\-\-color\-moved=no\fR\&.
  432. .RE
  433. .PP
  434. \fB\-\-color\-moved\-ws=\fR\fI<mode>\fR\fB,\&.\&.\fR\&.
  435. .RS 4
  436. This configures how whitespace is ignored when performing the move detection for
  437. \fB\-\-color\-moved\fR\&. These modes can be given as a comma separated list:
  438. .PP
  439. \fBno\fR
  440. .RS 4
  441. Do not ignore whitespace when performing move detection\&.
  442. .RE
  443. .PP
  444. \fBignore\-space\-at\-eol\fR
  445. .RS 4
  446. Ignore changes in whitespace at EOL\&.
  447. .RE
  448. .PP
  449. \fBignore\-space\-change\fR
  450. .RS 4
  451. Ignore changes in amount of whitespace\&. This ignores whitespace at line end, and considers all other sequences of one or more whitespace characters to be equivalent\&.
  452. .RE
  453. .PP
  454. \fBignore\-all\-space\fR
  455. .RS 4
  456. Ignore whitespace when comparing lines\&. This ignores differences even if one line has whitespace where the other line has none\&.
  457. .RE
  458. .PP
  459. \fBallow\-indentation\-change\fR
  460. .RS 4
  461. Initially ignore any whitespace in the move detection, then group the moved code blocks only into a block if the change in whitespace is the same per line\&. This is incompatible with the other modes\&.
  462. .RE
  463. .RE
  464. .PP
  465. \fB\-\-no\-color\-moved\-ws\fR
  466. .RS 4
  467. Do not ignore whitespace when performing move detection\&. This can be used to override configuration settings\&. It is the same as
  468. \fB\-\-color\-moved\-ws=no\fR\&.
  469. .RE
  470. .PP
  471. \fB\-\-word\-diff\fR[\fB=\fR\fI<mode>\fR]
  472. .RS 4
  473. By default, words are delimited by whitespace; see
  474. \fB\-\-word\-diff\-regex\fR
  475. below\&. The
  476. \fI<mode>\fR
  477. defaults to
  478. \fBplain\fR, and must be one of:
  479. .PP
  480. \fBcolor\fR
  481. .RS 4
  482. Highlight changed words using only colors\&. Implies
  483. \fB\-\-color\fR\&.
  484. .RE
  485. .PP
  486. \fBplain\fR
  487. .RS 4
  488. Show words as [\fB\-removed\-\fR] and {\fBadded\fR}\&. Makes no attempts to escape the delimiters if they appear in the input, so the output may be ambiguous\&.
  489. .RE
  490. .PP
  491. \fBporcelain\fR
  492. .RS 4
  493. Use a special line\-based format intended for script consumption\&. Added/removed/unchanged runs are printed in the usual unified diff format, starting with a
  494. \fB+\fR/\fB\-\fR/` ` character at the beginning of the line and extending to the end of the line\&. Newlines in the input are represented by a tilde
  495. \fB~\fR
  496. on a line of its own\&.
  497. .RE
  498. .PP
  499. \fBnone\fR
  500. .RS 4
  501. Disable word diff again\&.
  502. .RE
  503. .sp
  504. Note that despite the name of the first mode, color is used to highlight the changed parts in all modes if enabled\&.
  505. .RE
  506. .PP
  507. \fB\-\-word\-diff\-regex=\fR\fI<regex>\fR
  508. .RS 4
  509. Use
  510. \fI<regex>\fR
  511. to decide what a word is, instead of considering runs of non\-whitespace to be a word\&. Also implies
  512. \fB\-\-word\-diff\fR
  513. unless it was already enabled\&.
  514. .sp
  515. Every non\-overlapping match of the
  516. \fI<regex>\fR
  517. is considered a word\&. Anything between these matches is considered whitespace and ignored(!) for the purposes of finding differences\&. You may want to append |[\fB^\fR[\fB:space:\fR]] to your regular expression to make sure that it matches all non\-whitespace characters\&. A match that contains a newline is silently truncated(!) at the newline\&.
  518. .sp
  519. For example,
  520. \fB\-\-word\-diff\-regex=\&.\fR
  521. will treat each character as a word and, correspondingly, show differences character by character\&.
  522. .sp
  523. The regex can also be set via a diff driver or configuration option, see
  524. \fBgitattributes\fR(5)
  525. or
  526. \fBgit-config\fR(1)\&. Giving it explicitly overrides any diff driver or configuration setting\&. Diff drivers override configuration settings\&.
  527. .RE
  528. .PP
  529. \fB\-\-color\-words\fR[\fB=\fR\fI<regex>\fR]
  530. .RS 4
  531. Equivalent to
  532. \fB\-\-word\-diff=color\fR
  533. plus (if a regex was specified)
  534. \fB\-\-word\-diff\-regex=\fR\fI<regex>\fR\&.
  535. .RE
  536. .PP
  537. \fB\-\-no\-renames\fR
  538. .RS 4
  539. Turn off rename detection, even when the configuration file gives the default to do so\&.
  540. .RE
  541. .PP
  542. \fB\-\-\fR[\fBno\-\fR]\fBrename\-empty\fR
  543. .RS 4
  544. Whether to use empty blobs as rename source\&.
  545. .RE
  546. .PP
  547. \fB\-\-check\fR
  548. .RS 4
  549. Warn if changes introduce conflict markers or whitespace errors\&. What are considered whitespace errors is controlled by
  550. \fBcore\&.whitespace\fR
  551. configuration\&. By default, trailing whitespaces (including lines that consist solely of whitespaces) and a space character that is immediately followed by a tab character inside the initial indent of the line are considered whitespace errors\&. Exits with non\-zero status if problems are found\&. Not compatible with
  552. \fB\-\-exit\-code\fR\&.
  553. .RE
  554. .PP
  555. \fB\-\-ws\-error\-highlight=\fR\fI<kind>\fR
  556. .RS 4
  557. Highlight whitespace errors in the
  558. \fBcontext\fR,
  559. \fBold\fR
  560. or
  561. \fBnew\fR
  562. lines of the diff\&. Multiple values are separated by comma,
  563. \fBnone\fR
  564. resets previous values,
  565. \fBdefault\fR
  566. reset the list to
  567. \fBnew\fR
  568. and
  569. \fBall\fR
  570. is a shorthand for
  571. \fBold,new,context\fR\&. When this option is not given, and the configuration variable
  572. \fBdiff\&.wsErrorHighlight\fR
  573. is not set, only whitespace errors in
  574. \fBnew\fR
  575. lines are highlighted\&. The whitespace errors are colored with
  576. \fBcolor\&.diff\&.whitespace\fR\&.
  577. .RE
  578. .PP
  579. \fB\-\-full\-index\fR
  580. .RS 4
  581. Instead of the first handful of characters, show the full pre\- and post\-image blob object names on the "index" line when generating patch format output\&.
  582. .RE
  583. .PP
  584. \fB\-\-binary\fR
  585. .RS 4
  586. In addition to
  587. \fB\-\-full\-index\fR, output a binary diff that can be applied with
  588. \fBgit\-apply\fR\&. Implies
  589. \fB\-\-patch\fR\&.
  590. .RE
  591. .PP
  592. \fB\-\-abbrev\fR[\fB=\fR\fI<n>\fR]
  593. .RS 4
  594. Instead of showing the full 40\-byte hexadecimal object name in diff\-raw format output and diff\-tree header lines, show the shortest prefix that is at least
  595. \fI<n>\fR
  596. hexdigits long that uniquely refers the object\&. In diff\-patch output format,
  597. \fB\-\-full\-index\fR
  598. takes higher precedence, i\&.e\&. if
  599. \fB\-\-full\-index\fR
  600. is specified, full blob names will be shown regardless of
  601. \fB\-\-abbrev\fR\&. Non default number of digits can be specified with
  602. \fB\-\-abbrev=\fR\fI<n>\fR\&.
  603. .RE
  604. .PP
  605. \fB\-B\fR[\fI<n>\fR][\fB/\fR\fI<m>\fR], \fB\-\-break\-rewrites\fR[\fB=\fR[\fI<n>\fR][\fB/\fR\fI<m>\fR]]
  606. .RS 4
  607. Break complete rewrite changes into pairs of delete and create\&. This serves two purposes:
  608. .sp
  609. It affects the way a change that amounts to a total rewrite of a file not as a series of deletion and insertion mixed together with a very few lines that happen to match textually as the context, but as a single deletion of everything old followed by a single insertion of everything new, and the number
  610. \fI<m>\fR
  611. controls this aspect of the
  612. \fB\-B\fR
  613. option (defaults to 60%)\&.
  614. \fB\-B/70\fR% specifies that less than 30% of the original should remain in the result for Git to consider it a total rewrite (i\&.e\&. otherwise the resulting patch will be a series of deletion and insertion mixed together with context lines)\&.
  615. .sp
  616. When used with
  617. \fB\-M\fR, a totally\-rewritten file is also considered as the source of a rename (usually
  618. \fB\-M\fR
  619. only considers a file that disappeared as the source of a rename), and the number
  620. \fI<n>\fR
  621. controls this aspect of the
  622. \fB\-B\fR
  623. option (defaults to 50%)\&.
  624. \fB\-B20\fR% specifies that a change with addition and deletion compared to 20% or more of the file\(cqs size are eligible for being picked up as a possible source of a rename to another file\&.
  625. .RE
  626. .PP
  627. \fB\-M\fR[\fI<n>\fR], \fB\-\-find\-renames\fR[\fB=\fR\fI<n>\fR]
  628. .RS 4
  629. Detect renames\&. If
  630. \fI<n>\fR
  631. is specified, it is a threshold on the similarity index (i\&.e\&. amount of addition/deletions compared to the file\(cqs size)\&. For example,
  632. \fB\-M90\fR% means Git should consider a delete/add pair to be a rename if more than 90% of the file hasn\(cqt changed\&. Without a % sign, the number is to be read as a fraction, with a decimal point before it\&. I\&.e\&.,
  633. \fB\-M5\fR
  634. becomes 0\&.5, and is thus the same as
  635. \fB\-M50\fR%\&. Similarly,
  636. \fB\-M05\fR
  637. is the same as
  638. \fB\-M5\fR%\&. To limit detection to exact renames, use
  639. \fB\-M100\fR%\&. The default similarity index is 50%\&.
  640. .RE
  641. .PP
  642. \fB\-C\fR[\fI<n>\fR], \fB\-\-find\-copies\fR[\fB=\fR\fI<n>\fR]
  643. .RS 4
  644. Detect copies as well as renames\&. See also
  645. \fB\-\-find\-copies\-harder\fR\&. If
  646. \fI<n>\fR
  647. is specified, it has the same meaning as for
  648. \fB\-M\fR\fI<n>\fR\&.
  649. .RE
  650. .PP
  651. \fB\-\-find\-copies\-harder\fR
  652. .RS 4
  653. For performance reasons, by default,
  654. \fB\-C\fR
  655. option finds copies only if the original file of the copy was modified in the same changeset\&. This flag makes the command inspect unmodified files as candidates for the source of copy\&. This is a very expensive operation for large projects, so use it with caution\&. Giving more than one
  656. \fB\-C\fR
  657. option has the same effect\&.
  658. .RE
  659. .PP
  660. \fB\-D\fR, \fB\-\-irreversible\-delete\fR
  661. .RS 4
  662. Omit the preimage for deletes, i\&.e\&. print only the header but not the diff between the preimage and
  663. \fB/dev/null\fR\&. The resulting patch is not meant to be applied with
  664. \fBpatch\fR
  665. or
  666. \fBgit\fR
  667. \fBapply\fR; this is solely for people who want to just concentrate on reviewing the text after the change\&. In addition, the output obviously lacks enough information to apply such a patch in reverse, even manually, hence the name of the option\&.
  668. .sp
  669. When used together with
  670. \fB\-B\fR, omit also the preimage in the deletion part of a delete/create pair\&.
  671. .RE
  672. .PP
  673. \fB\-l\fR\fI<num>\fR
  674. .RS 4
  675. The
  676. \fB\-M\fR
  677. and
  678. \fB\-C\fR
  679. options involve some preliminary steps that can detect subsets of renames/copies cheaply, followed by an exhaustive fallback portion that compares all remaining unpaired destinations to all relevant sources\&. (For renames, only remaining unpaired sources are relevant; for copies, all original sources are relevant\&.) For N sources and destinations, this exhaustive check is O(N^2)\&. This option prevents the exhaustive portion of rename/copy detection from running if the number of source/destination files involved exceeds the specified number\&. Defaults to
  680. \fBdiff\&.renameLimit\fR\&. Note that a value of 0 is treated as unlimited\&.
  681. .RE
  682. .PP
  683. \fB\-\-diff\-filter=\fR[(\fBA\fR|\fBC\fR|\fBD\fR|\fBM\fR|\fBR\fR|\fBT\fR|\fBU\fR|\fBX\fR|\fBB\fR)\fB\&.\&.\&.\fR[*]]
  684. .RS 4
  685. Select only files that are Added (\fBA\fR), Copied (\fBC\fR), Deleted (\fBD\fR), Modified (\fBM\fR), Renamed (\fBR\fR), have their type (i\&.e\&. regular file, symlink, submodule, \&...\:) changed (\fBT\fR), are Unmerged (\fBU\fR), are Unknown (\fBX\fR), or have had their pairing Broken (\fBB\fR)\&. Any combination of the filter characters (including none) can be used\&. When * (All\-or\-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected\&.
  686. .sp
  687. Also, these upper\-case letters can be downcased to exclude\&. E\&.g\&.
  688. \fB\-\-diff\-filter=ad\fR
  689. excludes added and deleted paths\&.
  690. .sp
  691. Note that not all diffs can feature all types\&. For instance, copied and renamed entries cannot appear if detection for those types is disabled\&.
  692. .RE
  693. .PP
  694. \fB\-S\fR\fI<string>\fR
  695. .RS 4
  696. Look for differences that change the number of occurrences of the specified
  697. \fI<string>\fR
  698. (i\&.e\&. addition/deletion) in a file\&. Intended for the scripter\(cqs use\&.
  699. .sp
  700. It is useful when you\(cqre looking for an exact block of code (like a struct), and want to know the history of that block since it first came into being: use the feature iteratively to feed the interesting block in the preimage back into
  701. \fB\-S\fR, and keep going until you get the very first version of the block\&.
  702. .sp
  703. Binary files are searched as well\&.
  704. .RE
  705. .PP
  706. \fB\-G\fR\fI<regex>\fR
  707. .RS 4
  708. Look for differences whose patch text contains added/removed lines that match
  709. \fI<regex>\fR\&.
  710. .sp
  711. To illustrate the difference between
  712. \fB\-S\fR\fI<regex>\fR
  713. \fB\-\-pickaxe\-regex\fR
  714. and
  715. \fB\-G\fR\fI<regex>\fR, consider a commit with the following diff in the same file:
  716. .sp
  717. .if n \{\
  718. .RS 4
  719. .\}
  720. .nf
  721. + return frotz(nitfol, two\->ptr, 1, 0);
  722. \&.\&.\&.
  723. \- hit = frotz(nitfol, mf2\&.ptr, 1, 0);
  724. .fi
  725. .if n \{\
  726. .RE
  727. .\}
  728. .sp
  729. While
  730. \fBgit\fR
  731. \fBlog\fR
  732. \fB\-G\fR"frotz\e(\fBnitfol\fR" will show this commit,
  733. \fBgit\fR
  734. \fBlog\fR
  735. \fB\-S\fR"frotz\e(\fBnitfol\fR"
  736. \fB\-\-pickaxe\-regex\fR
  737. will not (because the number of occurrences of that string did not change)\&.
  738. .sp
  739. Unless
  740. \fB\-\-text\fR
  741. is supplied patches of binary files without a textconv filter will be ignored\&.
  742. .sp
  743. See the
  744. \fIpickaxe\fR
  745. entry in
  746. \fBgitdiffcore\fR(7)
  747. for more information\&.
  748. .RE
  749. .PP
  750. \fB\-\-find\-object=\fR\fI<object\-id>\fR
  751. .RS 4
  752. Look for differences that change the number of occurrences of the specified object\&. Similar to
  753. \fB\-S\fR, just the argument is different in that it doesn\(cqt search for a specific string but for a specific object id\&.
  754. .sp
  755. The object can be a blob or a submodule commit\&. It implies the
  756. \fB\-t\fR
  757. option in
  758. \fBgit\-log\fR
  759. to also find trees\&.
  760. .RE
  761. .PP
  762. \fB\-\-pickaxe\-all\fR
  763. .RS 4
  764. When
  765. \fB\-S\fR
  766. or
  767. \fB\-G\fR
  768. finds a change, show all the changes in that changeset, not just the files that contain the change in
  769. \fI<string>\fR\&.
  770. .RE
  771. .PP
  772. \fB\-\-pickaxe\-regex\fR
  773. .RS 4
  774. Treat the
  775. \fI<string>\fR
  776. given to
  777. \fB\-S\fR
  778. as an extended POSIX regular expression to match\&.
  779. .RE
  780. .PP
  781. \fB\-O\fR\fI<orderfile>\fR
  782. .RS 4
  783. Control the order in which files appear in the output\&. This overrides the
  784. \fBdiff\&.orderFile\fR
  785. configuration variable (see
  786. \fBgit-config\fR(1))\&. To cancel
  787. \fBdiff\&.orderFile\fR, use
  788. \fB\-O/dev/null\fR\&.
  789. .sp
  790. The output order is determined by the order of glob patterns in
  791. \fI<orderfile>\fR\&. All files with pathnames that match the first pattern are output first, all files with pathnames that match the second pattern (but not the first) are output next, and so on\&. All files with pathnames that do not match any pattern are output last, as if there was an implicit match\-all pattern at the end of the file\&. If multiple pathnames have the same rank (they match the same pattern but no earlier patterns), their output order relative to each other is the normal order\&.
  792. .sp
  793. \fI<orderfile>\fR
  794. is parsed as follows:
  795. .sp
  796. .RS 4
  797. .ie n \{\
  798. \h'-04'\(bu\h'+03'\c
  799. .\}
  800. .el \{\
  801. .sp -1
  802. .IP \(bu 2.3
  803. .\}
  804. Blank lines are ignored, so they can be used as separators for readability\&.
  805. .RE
  806. .sp
  807. .RS 4
  808. .ie n \{\
  809. \h'-04'\(bu\h'+03'\c
  810. .\}
  811. .el \{\
  812. .sp -1
  813. .IP \(bu 2.3
  814. .\}
  815. Lines starting with a hash ("#") are ignored, so they can be used for comments\&. Add a backslash ("\e") to the beginning of the pattern if it starts with a hash\&.
  816. .RE
  817. .sp
  818. .RS 4
  819. .ie n \{\
  820. \h'-04'\(bu\h'+03'\c
  821. .\}
  822. .el \{\
  823. .sp -1
  824. .IP \(bu 2.3
  825. .\}
  826. Each other line contains a single pattern\&.
  827. .RE
  828. .sp
  829. Patterns have the same syntax and semantics as patterns used for
  830. \fBfnmatch\fR(3) without the
  831. \fBFNM_PATHNAME\fR
  832. flag, except a pathname also matches a pattern if removing any number of the final pathname components matches the pattern\&. For example, the pattern "\fBfoo\fR*bar" matches "\fBfooasdfbar\fR" and "\fBfoo/bar/baz/asdf\fR" but not "\fBfoobarx\fR"\&.
  833. .RE
  834. .PP
  835. \fB\-\-skip\-to=\fR\fI<file>\fR, \fB\-\-rotate\-to=\fR\fI<file>\fR
  836. .RS 4
  837. Discard the files before the named
  838. \fI<file>\fR
  839. from the output (i\&.e\&.
  840. \fIskip to\fR), or move them to the end of the output (i\&.e\&.
  841. \fIrotate to\fR)\&. These options were invented primarily for the use of the
  842. \fBgit\fR
  843. \fBdifftool\fR
  844. command, and may not be very useful otherwise\&.
  845. .RE
  846. .PP
  847. \fB\-R\fR
  848. .RS 4
  849. Swap two inputs; that is, show differences from index or on\-disk file to tree contents\&.
  850. .RE
  851. .PP
  852. \fB\-\-relative\fR[\fB=\fR\fI<path>\fR], \fB\-\-no\-relative\fR
  853. .RS 4
  854. When run from a subdirectory of the project, it can be told to exclude changes outside the directory and show pathnames relative to it with this option\&. When you are not in a subdirectory (e\&.g\&. in a bare repository), you can name which subdirectory to make the output relative to by giving a
  855. \fI<path>\fR
  856. as an argument\&.
  857. \fB\-\-no\-relative\fR
  858. can be used to countermand both
  859. \fBdiff\&.relative\fR
  860. config option and previous
  861. \fB\-\-relative\fR\&.
  862. .RE
  863. .PP
  864. \fB\-a\fR, \fB\-\-text\fR
  865. .RS 4
  866. Treat all files as text\&.
  867. .RE
  868. .PP
  869. \fB\-\-ignore\-cr\-at\-eol\fR
  870. .RS 4
  871. Ignore carriage\-return at the end of line when doing a comparison\&.
  872. .RE
  873. .PP
  874. \fB\-\-ignore\-space\-at\-eol\fR
  875. .RS 4
  876. Ignore changes in whitespace at EOL\&.
  877. .RE
  878. .PP
  879. \fB\-b\fR, \fB\-\-ignore\-space\-change\fR
  880. .RS 4
  881. Ignore changes in amount of whitespace\&. This ignores whitespace at line end, and considers all other sequences of one or more whitespace characters to be equivalent\&.
  882. .RE
  883. .PP
  884. \fB\-w\fR, \fB\-\-ignore\-all\-space\fR
  885. .RS 4
  886. Ignore whitespace when comparing lines\&. This ignores differences even if one line has whitespace where the other line has none\&.
  887. .RE
  888. .PP
  889. \fB\-\-ignore\-blank\-lines\fR
  890. .RS 4
  891. Ignore changes whose lines are all blank\&.
  892. .RE
  893. .PP
  894. \fB\-I\fR\fI<regex>\fR, \fB\-\-ignore\-matching\-lines=\fR\fI<regex>\fR
  895. .RS 4
  896. Ignore changes whose all lines match
  897. \fI<regex>\fR\&. This option may be specified more than once\&.
  898. .RE
  899. .PP
  900. \fB\-\-inter\-hunk\-context=\fR\fI<number>\fR
  901. .RS 4
  902. Show the context between diff hunks, up to the specified
  903. \fI<number>\fR
  904. of lines, thereby fusing hunks that are close to each other\&. Defaults to
  905. \fBdiff\&.interHunkContext\fR
  906. or 0 if the config option is unset\&.
  907. .RE
  908. .PP
  909. \fB\-W\fR, \fB\-\-function\-context\fR
  910. .RS 4
  911. Show whole function as context lines for each change\&. The function names are determined in the same way as
  912. \fBgit\fR
  913. \fBdiff\fR
  914. works out patch hunk headers (see "Defining a custom hunk\-header" in
  915. \fBgitattributes\fR(5))\&.
  916. .RE
  917. .PP
  918. \fB\-\-exit\-code\fR
  919. .RS 4
  920. Make the program exit with codes similar to
  921. \fBdiff\fR(1)\&. That is, it exits with 1 if there were differences and 0 means no differences\&.
  922. .RE
  923. .PP
  924. \fB\-\-quiet\fR
  925. .RS 4
  926. Disable all output of the program\&. Implies
  927. \fB\-\-exit\-code\fR\&. Disables execution of external diff helpers whose exit code is not trusted, i\&.e\&. their respective configuration option
  928. \fBdiff\&.trustExitCode\fR
  929. or
  930. \fBdiff\&.\fR\fI<driver>\fR\&.\fBtrustExitCode\fR
  931. or environment variable
  932. \fBGIT_EXTERNAL_DIFF_TRUST_EXIT_CODE\fR
  933. is false\&.
  934. .RE
  935. .PP
  936. \fB\-\-ext\-diff\fR
  937. .RS 4
  938. Allow an external diff helper to be executed\&. If you set an external diff driver with
  939. \fBgitattributes\fR(5), you need to use this option with
  940. \fBgit-log\fR(1)
  941. and friends\&.
  942. .RE
  943. .PP
  944. \fB\-\-no\-ext\-diff\fR
  945. .RS 4
  946. Disallow external diff drivers\&.
  947. .RE
  948. .PP
  949. \fB\-\-textconv\fR, \fB\-\-no\-textconv\fR
  950. .RS 4
  951. Allow (or disallow) external text conversion filters to be run when comparing binary files\&. See
  952. \fBgitattributes\fR(5)
  953. for details\&. Because textconv filters are typically a one\-way conversion, the resulting diff is suitable for human consumption, but cannot be applied\&. For this reason, textconv filters are enabled by default only for
  954. \fBgit-diff\fR(1)
  955. and
  956. \fBgit-log\fR(1), but not for
  957. \fBgit-format-patch\fR(1)
  958. or diff plumbing commands\&.
  959. .RE
  960. .PP
  961. \fB\-\-ignore\-submodules\fR[\fB=\fR(\fBnone\fR|\fBuntracked\fR|\fBdirty\fR|\fBall\fR)]
  962. .RS 4
  963. Ignore changes to submodules in the diff generation\&.
  964. \fBall\fR
  965. is the default\&. Using
  966. \fBnone\fR
  967. will consider the submodule modified when it either contains untracked or modified files or its
  968. \fBHEAD\fR
  969. differs from the commit recorded in the superproject and can be used to override any settings of the
  970. \fBignore\fR
  971. option in
  972. \fBgit-config\fR(1)
  973. or
  974. \fBgitmodules\fR(5)\&. When
  975. \fBuntracked\fR
  976. is used submodules are not considered dirty when they only contain untracked content (but they are still scanned for modified content)\&. Using
  977. \fBdirty\fR
  978. ignores all changes to the work tree of submodules, only changes to the commits stored in the superproject are shown (this was the behavior until 1\&.7\&.0)\&. Using
  979. \fBall\fR
  980. hides all changes to submodules\&.
  981. .RE
  982. .PP
  983. \fB\-\-src\-prefix=\fR\fI<prefix>\fR
  984. .RS 4
  985. Show the given source
  986. \fI<prefix>\fR
  987. instead of "a/"\&.
  988. .RE
  989. .PP
  990. \fB\-\-dst\-prefix=\fR\fI<prefix>\fR
  991. .RS 4
  992. Show the given destination
  993. \fI<prefix>\fR
  994. instead of "b/"\&.
  995. .RE
  996. .PP
  997. \fB\-\-no\-prefix\fR
  998. .RS 4
  999. Do not show any source or destination prefix\&.
  1000. .RE
  1001. .PP
  1002. \fB\-\-default\-prefix\fR
  1003. .RS 4
  1004. Use the default source and destination prefixes ("a/" and "b/")\&. This overrides configuration variables such as
  1005. \fBdiff\&.noprefix\fR,
  1006. \fBdiff\&.srcPrefix\fR,
  1007. \fBdiff\&.dstPrefix\fR, and
  1008. \fBdiff\&.mnemonicPrefix\fR
  1009. (see
  1010. \fBgit-config\fR(1))\&.
  1011. .RE
  1012. .PP
  1013. \fB\-\-line\-prefix=\fR\fI<prefix>\fR
  1014. .RS 4
  1015. Prepend an additional
  1016. \fI<prefix>\fR
  1017. to every line of output\&.
  1018. .RE
  1019. .PP
  1020. \fB\-\-ita\-invisible\-in\-index\fR
  1021. .RS 4
  1022. By default entries added by
  1023. \fBgit\fR
  1024. \fBadd\fR
  1025. \fB\-N\fR
  1026. appear as an existing empty file in
  1027. \fBgit\fR
  1028. \fBdiff\fR
  1029. and a new file in
  1030. \fBgit\fR
  1031. \fBdiff\fR
  1032. \fB\-\-cached\fR\&. This option makes the entry appear as a new file in
  1033. \fBgit\fR
  1034. \fBdiff\fR
  1035. and non\-existent in
  1036. \fBgit\fR
  1037. \fBdiff\fR
  1038. \fB\-\-cached\fR\&. This option could be reverted with
  1039. \fB\-\-ita\-visible\-in\-index\fR\&. Both options are experimental and could be removed in future\&.
  1040. .RE
  1041. .sp
  1042. For more detailed explanation on these common options, see also \fBgitdiffcore\fR(7)\&.
  1043. .PP
  1044. <tree\-ish>
  1045. .RS 4
  1046. The id of a tree object\&.
  1047. .RE
  1048. .PP
  1049. <path>\&...\:
  1050. .RS 4
  1051. If provided, the results are limited to a subset of files matching one of the provided pathspecs\&.
  1052. .RE
  1053. .PP
  1054. \-r
  1055. .RS 4
  1056. Recurse into sub\-trees\&.
  1057. .RE
  1058. .PP
  1059. \-t
  1060. .RS 4
  1061. Show tree entry itself as well as subtrees\&. Implies \-r\&.
  1062. .RE
  1063. .PP
  1064. \-\-root
  1065. .RS 4
  1066. When
  1067. \fB\-\-root\fR
  1068. is specified the initial commit will be shown as a big creation event\&. This is equivalent to a diff against the NULL tree\&.
  1069. .RE
  1070. .PP
  1071. \-\-merge\-base
  1072. .RS 4
  1073. Instead of comparing the <tree\-ish>s directly, use the merge base between the two <tree\-ish>s as the "before" side\&. There must be two <tree\-ish>s given and they must both be commits\&.
  1074. .RE
  1075. .PP
  1076. \-\-stdin
  1077. .RS 4
  1078. When
  1079. \fB\-\-stdin\fR
  1080. is specified, the command does not take <tree\-ish> arguments from the command line\&. Instead, it reads lines containing either two <tree>, one <commit>, or a list of <commit> from its standard input\&. (Use a single space as separator\&.)
  1081. .sp
  1082. When two trees are given, it compares the first tree with the second\&. When a single commit is given, it compares the commit with its parents\&. The remaining commits, when given, are used as if they are parents of the first commit\&.
  1083. .sp
  1084. When comparing two trees, the ID of both trees (separated by a space and terminated by a newline) is printed before the difference\&. When comparing commits, the ID of the first (or only) commit, followed by a newline, is printed\&.
  1085. .sp
  1086. The following flags further affect the behavior when comparing commits (but not trees)\&.
  1087. .RE
  1088. .PP
  1089. \-m
  1090. .RS 4
  1091. By default,
  1092. \fIgit diff\-tree \-\-stdin\fR
  1093. does not show differences for merge commits\&. With this flag, it shows differences to that commit from all of its parents\&. See also
  1094. \fB\-c\fR\&.
  1095. .RE
  1096. .PP
  1097. \-s
  1098. .RS 4
  1099. By default,
  1100. \fIgit diff\-tree \-\-stdin\fR
  1101. shows differences, either in machine\-readable form (without
  1102. \fB\-p\fR) or in patch form (with
  1103. \fB\-p\fR)\&. This output can be suppressed\&. It is only useful with the
  1104. \fB\-v\fR
  1105. flag\&.
  1106. .RE
  1107. .PP
  1108. \-v
  1109. .RS 4
  1110. This flag causes
  1111. \fIgit diff\-tree \-\-stdin\fR
  1112. to also show the commit message before the differences\&.
  1113. .RE
  1114. .PP
  1115. \-\-pretty[=<format>], \-\-format=<format>
  1116. .RS 4
  1117. Pretty\-print the contents of the commit logs in a given format, where
  1118. \fI<format>\fR
  1119. can be one of
  1120. \fIoneline\fR,
  1121. \fIshort\fR,
  1122. \fImedium\fR,
  1123. \fIfull\fR,
  1124. \fIfuller\fR,
  1125. \fIreference\fR,
  1126. \fIemail\fR,
  1127. \fIraw\fR,
  1128. \fIformat:<string>\fR
  1129. and
  1130. \fItformat:<string>\fR\&. When
  1131. \fI<format>\fR
  1132. is none of the above, and has
  1133. \fI%placeholder\fR
  1134. in it, it acts as if
  1135. \fI\-\-pretty=tformat:<format>\fR
  1136. were given\&.
  1137. .sp
  1138. See the "PRETTY FORMATS" section for some additional details for each format\&. When
  1139. \fI=<format>\fR
  1140. part is omitted, it defaults to
  1141. \fImedium\fR\&.
  1142. .sp
  1143. Note: you can specify the default pretty format in the repository configuration (see
  1144. \fBgit-config\fR(1))\&.
  1145. .RE
  1146. .PP
  1147. \-\-abbrev\-commit
  1148. .RS 4
  1149. Instead of showing the full 40\-byte hexadecimal commit object name, show a prefix that names the object uniquely\&. "\-\-abbrev=<n>" (which also modifies diff output, if it is displayed) option can be used to specify the minimum length of the prefix\&.
  1150. .sp
  1151. This should make "\-\-pretty=oneline" a whole lot more readable for people using 80\-column terminals\&.
  1152. .RE
  1153. .PP
  1154. \-\-no\-abbrev\-commit
  1155. .RS 4
  1156. Show the full 40\-byte hexadecimal commit object name\&. This negates
  1157. \fB\-\-abbrev\-commit\fR, either explicit or implied by other options such as "\-\-oneline"\&. It also overrides the
  1158. \fBlog\&.abbrevCommit\fR
  1159. variable\&.
  1160. .RE
  1161. .PP
  1162. \-\-oneline
  1163. .RS 4
  1164. This is a shorthand for "\-\-pretty=oneline \-\-abbrev\-commit" used together\&.
  1165. .RE
  1166. .PP
  1167. \-\-encoding=<encoding>
  1168. .RS 4
  1169. Commit objects record the character encoding used for the log message in their encoding header; this option can be used to tell the command to re\-code the commit log message in the encoding preferred by the user\&. For non plumbing commands this defaults to UTF\-8\&. Note that if an object claims to be encoded in
  1170. \fBX\fR
  1171. and we are outputting in
  1172. \fBX\fR, we will output the object verbatim; this means that invalid sequences in the original commit may be copied to the output\&. Likewise, if iconv(3) fails to convert the commit, we will quietly output the original object verbatim\&.
  1173. .RE
  1174. .PP
  1175. \-\-expand\-tabs=<n>, \-\-expand\-tabs, \-\-no\-expand\-tabs
  1176. .RS 4
  1177. Perform a tab expansion (replace each tab with enough spaces to fill to the next display column that is a multiple of
  1178. \fI<n>\fR) in the log message before showing it in the output\&.
  1179. \fB\-\-expand\-tabs\fR
  1180. is a short\-hand for
  1181. \fB\-\-expand\-tabs=8\fR, and
  1182. \fB\-\-no\-expand\-tabs\fR
  1183. is a short\-hand for
  1184. \fB\-\-expand\-tabs=0\fR, which disables tab expansion\&.
  1185. .sp
  1186. By default, tabs are expanded in pretty formats that indent the log message by 4 spaces (i\&.e\&.
  1187. \fImedium\fR, which is the default,
  1188. \fIfull\fR, and
  1189. \fIfuller\fR)\&.
  1190. .RE
  1191. .PP
  1192. \-\-notes[=<ref>]
  1193. .RS 4
  1194. Show the notes (see
  1195. \fBgit-notes\fR(1)) that annotate the commit, when showing the commit log message\&. This is the default for
  1196. \fBgit\fR
  1197. \fBlog\fR,
  1198. \fBgit\fR
  1199. \fBshow\fR
  1200. and
  1201. \fBgit\fR
  1202. \fBwhatchanged\fR
  1203. commands when there is no
  1204. \fB\-\-pretty\fR,
  1205. \fB\-\-format\fR, or
  1206. \fB\-\-oneline\fR
  1207. option given on the command line\&.
  1208. .sp
  1209. By default, the notes shown are from the notes refs listed in the
  1210. \fBcore\&.notesRef\fR
  1211. and
  1212. \fBnotes\&.displayRef\fR
  1213. variables (or corresponding environment overrides)\&. See
  1214. \fBgit-config\fR(1)
  1215. for more details\&.
  1216. .sp
  1217. With an optional
  1218. \fI<ref>\fR
  1219. argument, use the ref to find the notes to display\&. The ref can specify the full refname when it begins with
  1220. \fBrefs/notes/\fR; when it begins with
  1221. \fBnotes/\fR,
  1222. \fBrefs/\fR
  1223. and otherwise
  1224. \fBrefs/notes/\fR
  1225. is prefixed to form the full name of the ref\&.
  1226. .sp
  1227. Multiple \-\-notes options can be combined to control which notes are being displayed\&. Examples: "\-\-notes=foo" will show only notes from "refs/notes/foo"; "\-\-notes=foo \-\-notes" will show both notes from "refs/notes/foo" and from the default notes ref(s)\&.
  1228. .RE
  1229. .PP
  1230. \-\-no\-notes
  1231. .RS 4
  1232. Do not show notes\&. This negates the above
  1233. \fB\-\-notes\fR
  1234. option, by resetting the list of notes refs from which notes are shown\&. Options are parsed in the order given on the command line, so e\&.g\&. "\-\-notes \-\-notes=foo \-\-no\-notes \-\-notes=bar" will only show notes from "refs/notes/bar"\&.
  1235. .RE
  1236. .PP
  1237. \-\-show\-notes\-by\-default
  1238. .RS 4
  1239. Show the default notes unless options for displaying specific notes are given\&.
  1240. .RE
  1241. .PP
  1242. \-\-show\-notes[=<ref>], \-\-[no\-]standard\-notes
  1243. .RS 4
  1244. These options are deprecated\&. Use the above \-\-notes/\-\-no\-notes options instead\&.
  1245. .RE
  1246. .PP
  1247. \-\-show\-signature
  1248. .RS 4
  1249. Check the validity of a signed commit object by passing the signature to
  1250. \fBgpg\fR
  1251. \fB\-\-verify\fR
  1252. and show the output\&.
  1253. .RE
  1254. .PP
  1255. \-\-no\-commit\-id
  1256. .RS 4
  1257. \fIgit diff\-tree\fR
  1258. outputs a line with the commit ID when applicable\&. This flag suppresses the commit ID output\&.
  1259. .RE
  1260. .PP
  1261. \-c
  1262. .RS 4
  1263. This flag changes the way a merge commit is displayed (which means it is useful only when the command is given one <tree\-ish>, or
  1264. \fB\-\-stdin\fR)\&. It shows the differences from each of the parents to the merge result simultaneously instead of showing pairwise diff between a parent and the result one at a time (which is what the
  1265. \fB\-m\fR
  1266. option does)\&. Furthermore, it lists only files which were modified from all parents\&.
  1267. .RE
  1268. .PP
  1269. \-\-cc
  1270. .RS 4
  1271. This flag changes the way a merge commit patch is displayed, in a similar way to the
  1272. \fB\-c\fR
  1273. option\&. It implies the
  1274. \fB\-c\fR
  1275. and
  1276. \fB\-p\fR
  1277. options and further compresses the patch output by omitting uninteresting hunks whose contents in the parents have only two variants and the merge result picks one of them without modification\&. When all hunks are uninteresting, the commit itself and the commit log message are not shown, just like in any other "empty diff" case\&.
  1278. .RE
  1279. .PP
  1280. \-\-combined\-all\-paths
  1281. .RS 4
  1282. This flag causes combined diffs (used for merge commits) to list the name of the file from all parents\&. It thus only has effect when \-c or \-\-cc are specified, and is likely only useful if filename changes are detected (i\&.e\&. when either rename or copy detection have been requested)\&.
  1283. .RE
  1284. .PP
  1285. \-\-always
  1286. .RS 4
  1287. Show the commit itself and the commit log message even if the diff itself is empty\&.
  1288. .RE
  1289. .SH "PRETTY FORMATS"
  1290. .sp
  1291. If the commit is a merge, and if the pretty\-format is not \fIoneline\fR, \fIemail\fR or \fIraw\fR, an additional line is inserted before the \fIAuthor:\fR line\&. This line begins with "Merge: " and the hashes of ancestral commits are printed, separated by spaces\&. Note that the listed commits may not necessarily be the list of the \fBdirect\fR parent commits if you have limited your view of history: for example, if you are only interested in changes related to a certain directory or file\&.
  1292. .sp
  1293. There are several built\-in formats, and you can define additional formats by setting a pretty\&.<name> config option to either another format name, or a \fIformat:\fR string, as described below (see \fBgit-config\fR(1))\&. Here are the details of the built\-in formats:
  1294. .sp
  1295. .RS 4
  1296. .ie n \{\
  1297. \h'-04'\(bu\h'+03'\c
  1298. .\}
  1299. .el \{\
  1300. .sp -1
  1301. .IP \(bu 2.3
  1302. .\}
  1303. \fIoneline\fR
  1304. .sp
  1305. .if n \{\
  1306. .RS 4
  1307. .\}
  1308. .nf
  1309. <hash> <title\-line>
  1310. .fi
  1311. .if n \{\
  1312. .RE
  1313. .\}
  1314. .sp
  1315. This is designed to be as compact as possible\&.
  1316. .RE
  1317. .sp
  1318. .RS 4
  1319. .ie n \{\
  1320. \h'-04'\(bu\h'+03'\c
  1321. .\}
  1322. .el \{\
  1323. .sp -1
  1324. .IP \(bu 2.3
  1325. .\}
  1326. \fIshort\fR
  1327. .sp
  1328. .if n \{\
  1329. .RS 4
  1330. .\}
  1331. .nf
  1332. commit <hash>
  1333. Author: <author>
  1334. .fi
  1335. .if n \{\
  1336. .RE
  1337. .\}
  1338. .sp
  1339. .if n \{\
  1340. .RS 4
  1341. .\}
  1342. .nf
  1343. <title\-line>
  1344. .fi
  1345. .if n \{\
  1346. .RE
  1347. .\}
  1348. .RE
  1349. .sp
  1350. .RS 4
  1351. .ie n \{\
  1352. \h'-04'\(bu\h'+03'\c
  1353. .\}
  1354. .el \{\
  1355. .sp -1
  1356. .IP \(bu 2.3
  1357. .\}
  1358. \fImedium\fR
  1359. .sp
  1360. .if n \{\
  1361. .RS 4
  1362. .\}
  1363. .nf
  1364. commit <hash>
  1365. Author: <author>
  1366. Date: <author\-date>
  1367. .fi
  1368. .if n \{\
  1369. .RE
  1370. .\}
  1371. .sp
  1372. .if n \{\
  1373. .RS 4
  1374. .\}
  1375. .nf
  1376. <title\-line>
  1377. .fi
  1378. .if n \{\
  1379. .RE
  1380. .\}
  1381. .sp
  1382. .if n \{\
  1383. .RS 4
  1384. .\}
  1385. .nf
  1386. <full\-commit\-message>
  1387. .fi
  1388. .if n \{\
  1389. .RE
  1390. .\}
  1391. .RE
  1392. .sp
  1393. .RS 4
  1394. .ie n \{\
  1395. \h'-04'\(bu\h'+03'\c
  1396. .\}
  1397. .el \{\
  1398. .sp -1
  1399. .IP \(bu 2.3
  1400. .\}
  1401. \fIfull\fR
  1402. .sp
  1403. .if n \{\
  1404. .RS 4
  1405. .\}
  1406. .nf
  1407. commit <hash>
  1408. Author: <author>
  1409. Commit: <committer>
  1410. .fi
  1411. .if n \{\
  1412. .RE
  1413. .\}
  1414. .sp
  1415. .if n \{\
  1416. .RS 4
  1417. .\}
  1418. .nf
  1419. <title\-line>
  1420. .fi
  1421. .if n \{\
  1422. .RE
  1423. .\}
  1424. .sp
  1425. .if n \{\
  1426. .RS 4
  1427. .\}
  1428. .nf
  1429. <full\-commit\-message>
  1430. .fi
  1431. .if n \{\
  1432. .RE
  1433. .\}
  1434. .RE
  1435. .sp
  1436. .RS 4
  1437. .ie n \{\
  1438. \h'-04'\(bu\h'+03'\c
  1439. .\}
  1440. .el \{\
  1441. .sp -1
  1442. .IP \(bu 2.3
  1443. .\}
  1444. \fIfuller\fR
  1445. .sp
  1446. .if n \{\
  1447. .RS 4
  1448. .\}
  1449. .nf
  1450. commit <hash>
  1451. Author: <author>
  1452. AuthorDate: <author\-date>
  1453. Commit: <committer>
  1454. CommitDate: <committer\-date>
  1455. .fi
  1456. .if n \{\
  1457. .RE
  1458. .\}
  1459. .sp
  1460. .if n \{\
  1461. .RS 4
  1462. .\}
  1463. .nf
  1464. <title\-line>
  1465. .fi
  1466. .if n \{\
  1467. .RE
  1468. .\}
  1469. .sp
  1470. .if n \{\
  1471. .RS 4
  1472. .\}
  1473. .nf
  1474. <full\-commit\-message>
  1475. .fi
  1476. .if n \{\
  1477. .RE
  1478. .\}
  1479. .RE
  1480. .sp
  1481. .RS 4
  1482. .ie n \{\
  1483. \h'-04'\(bu\h'+03'\c
  1484. .\}
  1485. .el \{\
  1486. .sp -1
  1487. .IP \(bu 2.3
  1488. .\}
  1489. \fIreference\fR
  1490. .sp
  1491. .if n \{\
  1492. .RS 4
  1493. .\}
  1494. .nf
  1495. <abbrev\-hash> (<title\-line>, <short\-author\-date>)
  1496. .fi
  1497. .if n \{\
  1498. .RE
  1499. .\}
  1500. .sp
  1501. This format is used to refer to another commit in a commit message and is the same as
  1502. \fB\-\-pretty=\fR\*(Aqformat:%C(\fBauto\fR)%h (%s, %ad)\*(Aq\&. By default, the date is formatted with
  1503. \fB\-\-date=short\fR
  1504. unless another
  1505. \fB\-\-date\fR
  1506. option is explicitly specified\&. As with any
  1507. \fBformat:\fR
  1508. with format placeholders, its output is not affected by other options like
  1509. \fB\-\-decorate\fR
  1510. and
  1511. \fB\-\-walk\-reflogs\fR\&.
  1512. .RE
  1513. .sp
  1514. .RS 4
  1515. .ie n \{\
  1516. \h'-04'\(bu\h'+03'\c
  1517. .\}
  1518. .el \{\
  1519. .sp -1
  1520. .IP \(bu 2.3
  1521. .\}
  1522. \fIemail\fR
  1523. .sp
  1524. .if n \{\
  1525. .RS 4
  1526. .\}
  1527. .nf
  1528. From <hash> <date>
  1529. From: <author>
  1530. Date: <author\-date>
  1531. Subject: [PATCH] <title\-line>
  1532. .fi
  1533. .if n \{\
  1534. .RE
  1535. .\}
  1536. .sp
  1537. .if n \{\
  1538. .RS 4
  1539. .\}
  1540. .nf
  1541. <full\-commit\-message>
  1542. .fi
  1543. .if n \{\
  1544. .RE
  1545. .\}
  1546. .RE
  1547. .sp
  1548. .RS 4
  1549. .ie n \{\
  1550. \h'-04'\(bu\h'+03'\c
  1551. .\}
  1552. .el \{\
  1553. .sp -1
  1554. .IP \(bu 2.3
  1555. .\}
  1556. \fImboxrd\fR
  1557. .sp
  1558. Like
  1559. \fIemail\fR, but lines in the commit message starting with "From " (preceded by zero or more ">") are quoted with ">" so they aren\(cqt confused as starting a new commit\&.
  1560. .RE
  1561. .sp
  1562. .RS 4
  1563. .ie n \{\
  1564. \h'-04'\(bu\h'+03'\c
  1565. .\}
  1566. .el \{\
  1567. .sp -1
  1568. .IP \(bu 2.3
  1569. .\}
  1570. \fIraw\fR
  1571. .sp
  1572. The
  1573. \fIraw\fR
  1574. format shows the entire commit exactly as stored in the commit object\&. Notably, the hashes are displayed in full, regardless of whether \-\-abbrev or \-\-no\-abbrev are used, and
  1575. \fIparents\fR
  1576. information show the true parent commits, without taking grafts or history simplification into account\&. Note that this format affects the way commits are displayed, but not the way the diff is shown e\&.g\&. with
  1577. \fBgit\fR
  1578. \fBlog\fR
  1579. \fB\-\-raw\fR\&. To get full object names in a raw diff format, use
  1580. \fB\-\-no\-abbrev\fR\&.
  1581. .RE
  1582. .sp
  1583. .RS 4
  1584. .ie n \{\
  1585. \h'-04'\(bu\h'+03'\c
  1586. .\}
  1587. .el \{\
  1588. .sp -1
  1589. .IP \(bu 2.3
  1590. .\}
  1591. \fIformat:<format\-string>\fR
  1592. .sp
  1593. The
  1594. \fIformat:<format\-string>\fR
  1595. format allows you to specify which information you want to show\&. It works a little bit like printf format, with the notable exception that you get a newline with
  1596. \fI%n\fR
  1597. instead of
  1598. \fI\en\fR\&.
  1599. .sp
  1600. E\&.g,
  1601. \fIformat:"The author of %h was %an, %ar%nThe title was >>%s<<%n"\fR
  1602. would show something like this:
  1603. .sp
  1604. .if n \{\
  1605. .RS 4
  1606. .\}
  1607. .nf
  1608. The author of fe6e0ee was Junio C Hamano, 23 hours ago
  1609. The title was >>t4119: test autocomputing \-p<n> for traditional diff input\&.<<
  1610. .fi
  1611. .if n \{\
  1612. .RE
  1613. .\}
  1614. .sp
  1615. The placeholders are:
  1616. .sp
  1617. .RS 4
  1618. .ie n \{\
  1619. \h'-04'\(bu\h'+03'\c
  1620. .\}
  1621. .el \{\
  1622. .sp -1
  1623. .IP \(bu 2.3
  1624. .\}
  1625. Placeholders that expand to a single literal character:
  1626. .PP
  1627. \fI%n\fR
  1628. .RS 4
  1629. newline
  1630. .RE
  1631. .PP
  1632. \fI%%\fR
  1633. .RS 4
  1634. a raw
  1635. \fI%\fR
  1636. .RE
  1637. .PP
  1638. \fI%x00\fR
  1639. .RS 4
  1640. \fI%x\fR
  1641. followed by two hexadecimal digits is replaced with a byte with the hexadecimal digits\*(Aq value (we will call this "literal formatting code" in the rest of this document)\&.
  1642. .RE
  1643. .RE
  1644. .sp
  1645. .RS 4
  1646. .ie n \{\
  1647. \h'-04'\(bu\h'+03'\c
  1648. .\}
  1649. .el \{\
  1650. .sp -1
  1651. .IP \(bu 2.3
  1652. .\}
  1653. Placeholders that affect formatting of later placeholders:
  1654. .PP
  1655. \fI%Cred\fR
  1656. .RS 4
  1657. switch color to red
  1658. .RE
  1659. .PP
  1660. \fI%Cgreen\fR
  1661. .RS 4
  1662. switch color to green
  1663. .RE
  1664. .PP
  1665. \fI%Cblue\fR
  1666. .RS 4
  1667. switch color to blue
  1668. .RE
  1669. .PP
  1670. \fI%Creset\fR
  1671. .RS 4
  1672. reset color
  1673. .RE
  1674. .PP
  1675. \fI%C(\&...\:)\fR
  1676. .RS 4
  1677. color specification, as described under Values in the "CONFIGURATION FILE" section of
  1678. \fBgit-config\fR(1)\&. By default, colors are shown only when enabled for log output (by
  1679. \fBcolor\&.diff\fR,
  1680. \fBcolor\&.ui\fR, or
  1681. \fB\-\-color\fR, and respecting the
  1682. \fBauto\fR
  1683. settings of the former if we are going to a terminal)\&. %C(\fBauto,\fR\fB\&.\&.\&.\fR) is accepted as a historical synonym for the default (e\&.g\&., %C(\fBauto,red\fR))\&. Specifying %C(\fBalways,\fR\fB\&.\&.\&.\fR) will show the colors even when color is not otherwise enabled (though consider just using
  1684. \fB\-\-color=always\fR
  1685. to enable color for the whole output, including this format and anything else git might color)\&.
  1686. \fBauto\fR
  1687. alone (i\&.e\&. %C(\fBauto\fR)) will turn on auto coloring on the next placeholders until the color is switched again\&.
  1688. .RE
  1689. .PP
  1690. \fI%m\fR
  1691. .RS 4
  1692. left (<), right (>) or boundary (\fB\-\fR) mark
  1693. .RE
  1694. .PP
  1695. \fI%w([<w>[,<i1>[,<i2>]]])\fR
  1696. .RS 4
  1697. switch line wrapping, like the \-w option of
  1698. \fBgit-shortlog\fR(1)\&.
  1699. .RE
  1700. .PP
  1701. \fI%<( <N> [,trunc|ltrunc|mtrunc])\fR
  1702. .RS 4
  1703. make the next placeholder take at least N column widths, padding spaces on the right if necessary\&. Optionally truncate (with ellipsis
  1704. \fI\&.\&.\fR) at the left (ltrunc)
  1705. \fB\&.\&.\fR\fBft\fR, the middle (mtrunc)
  1706. \fBmi\fR\fB\&.\&.\fR\fBle\fR, or the end (trunc)
  1707. \fBrig\&.\&.\fR, if the output is longer than N columns\&. Note 1: that truncating only works correctly with N >= 2\&. Note 2: spaces around the N and M (see below) values are optional\&. Note 3: Emojis and other wide characters will take two display columns, which may over\-run column boundaries\&. Note 4: decomposed character combining marks may be misplaced at padding boundaries\&.
  1708. .RE
  1709. .PP
  1710. \fI%<|( <M> )\fR
  1711. .RS 4
  1712. make the next placeholder take at least until Mth display column, padding spaces on the right if necessary\&. Use negative M values for column positions measured from the right hand edge of the terminal window\&.
  1713. .RE
  1714. .PP
  1715. \fI%>( <N> )\fR, \fI%>|( <M> )\fR
  1716. .RS 4
  1717. similar to
  1718. \fI%<( <N> )\fR,
  1719. \fI%<|( <M> )\fR
  1720. respectively, but padding spaces on the left
  1721. .RE
  1722. .PP
  1723. \fI%>>( <N> )\fR, \fI%>>|( <M> )\fR
  1724. .RS 4
  1725. similar to
  1726. \fI%>( <N> )\fR,
  1727. \fI%>|( <M> )\fR
  1728. respectively, except that if the next placeholder takes more spaces than given and there are spaces on its left, use those spaces
  1729. .RE
  1730. .PP
  1731. \fI%><( <N> )\fR, \fI%><|( <M> )\fR
  1732. .RS 4
  1733. similar to
  1734. \fI%<( <N> )\fR,
  1735. \fI%<|( <M> )\fR
  1736. respectively, but padding both sides (i\&.e\&. the text is centered)
  1737. .RE
  1738. .RE
  1739. .sp
  1740. .RS 4
  1741. .ie n \{\
  1742. \h'-04'\(bu\h'+03'\c
  1743. .\}
  1744. .el \{\
  1745. .sp -1
  1746. .IP \(bu 2.3
  1747. .\}
  1748. Placeholders that expand to information extracted from the commit:
  1749. .PP
  1750. \fI%H\fR
  1751. .RS 4
  1752. commit hash
  1753. .RE
  1754. .PP
  1755. \fI%h\fR
  1756. .RS 4
  1757. abbreviated commit hash
  1758. .RE
  1759. .PP
  1760. \fI%T\fR
  1761. .RS 4
  1762. tree hash
  1763. .RE
  1764. .PP
  1765. \fI%t\fR
  1766. .RS 4
  1767. abbreviated tree hash
  1768. .RE
  1769. .PP
  1770. \fI%P\fR
  1771. .RS 4
  1772. parent hashes
  1773. .RE
  1774. .PP
  1775. \fI%p\fR
  1776. .RS 4
  1777. abbreviated parent hashes
  1778. .RE
  1779. .PP
  1780. \fI%an\fR
  1781. .RS 4
  1782. author name
  1783. .RE
  1784. .PP
  1785. \fI%aN\fR
  1786. .RS 4
  1787. author name (respecting \&.mailmap, see
  1788. \fBgit-shortlog\fR(1)
  1789. or
  1790. \fBgit-blame\fR(1))
  1791. .RE
  1792. .PP
  1793. \fI%ae\fR
  1794. .RS 4
  1795. author email
  1796. .RE
  1797. .PP
  1798. \fI%aE\fR
  1799. .RS 4
  1800. author email (respecting \&.mailmap, see
  1801. \fBgit-shortlog\fR(1)
  1802. or
  1803. \fBgit-blame\fR(1))
  1804. .RE
  1805. .PP
  1806. \fI%al\fR
  1807. .RS 4
  1808. author email local\-part (the part before the
  1809. \fI@\fR
  1810. sign)
  1811. .RE
  1812. .PP
  1813. \fI%aL\fR
  1814. .RS 4
  1815. author local\-part (see
  1816. \fI%al\fR) respecting \&.mailmap, see
  1817. \fBgit-shortlog\fR(1)
  1818. or
  1819. \fBgit-blame\fR(1))
  1820. .RE
  1821. .PP
  1822. \fI%ad\fR
  1823. .RS 4
  1824. author date (format respects \-\-date= option)
  1825. .RE
  1826. .PP
  1827. \fI%aD\fR
  1828. .RS 4
  1829. author date, RFC2822 style
  1830. .RE
  1831. .PP
  1832. \fI%ar\fR
  1833. .RS 4
  1834. author date, relative
  1835. .RE
  1836. .PP
  1837. \fI%at\fR
  1838. .RS 4
  1839. author date, UNIX timestamp
  1840. .RE
  1841. .PP
  1842. \fI%ai\fR
  1843. .RS 4
  1844. author date, ISO 8601\-like format
  1845. .RE
  1846. .PP
  1847. \fI%aI\fR
  1848. .RS 4
  1849. author date, strict ISO 8601 format
  1850. .RE
  1851. .PP
  1852. \fI%as\fR
  1853. .RS 4
  1854. author date, short format (\fBYYYY\-MM\-DD\fR)
  1855. .RE
  1856. .PP
  1857. \fI%ah\fR
  1858. .RS 4
  1859. author date, human style (like the
  1860. \fB\-\-date=human\fR
  1861. option of
  1862. \fBgit-rev-list\fR(1))
  1863. .RE
  1864. .PP
  1865. \fI%cn\fR
  1866. .RS 4
  1867. committer name
  1868. .RE
  1869. .PP
  1870. \fI%cN\fR
  1871. .RS 4
  1872. committer name (respecting \&.mailmap, see
  1873. \fBgit-shortlog\fR(1)
  1874. or
  1875. \fBgit-blame\fR(1))
  1876. .RE
  1877. .PP
  1878. \fI%ce\fR
  1879. .RS 4
  1880. committer email
  1881. .RE
  1882. .PP
  1883. \fI%cE\fR
  1884. .RS 4
  1885. committer email (respecting \&.mailmap, see
  1886. \fBgit-shortlog\fR(1)
  1887. or
  1888. \fBgit-blame\fR(1))
  1889. .RE
  1890. .PP
  1891. \fI%cl\fR
  1892. .RS 4
  1893. committer email local\-part (the part before the
  1894. \fI@\fR
  1895. sign)
  1896. .RE
  1897. .PP
  1898. \fI%cL\fR
  1899. .RS 4
  1900. committer local\-part (see
  1901. \fI%cl\fR) respecting \&.mailmap, see
  1902. \fBgit-shortlog\fR(1)
  1903. or
  1904. \fBgit-blame\fR(1))
  1905. .RE
  1906. .PP
  1907. \fI%cd\fR
  1908. .RS 4
  1909. committer date (format respects \-\-date= option)
  1910. .RE
  1911. .PP
  1912. \fI%cD\fR
  1913. .RS 4
  1914. committer date, RFC2822 style
  1915. .RE
  1916. .PP
  1917. \fI%cr\fR
  1918. .RS 4
  1919. committer date, relative
  1920. .RE
  1921. .PP
  1922. \fI%ct\fR
  1923. .RS 4
  1924. committer date, UNIX timestamp
  1925. .RE
  1926. .PP
  1927. \fI%ci\fR
  1928. .RS 4
  1929. committer date, ISO 8601\-like format
  1930. .RE
  1931. .PP
  1932. \fI%cI\fR
  1933. .RS 4
  1934. committer date, strict ISO 8601 format
  1935. .RE
  1936. .PP
  1937. \fI%cs\fR
  1938. .RS 4
  1939. committer date, short format (\fBYYYY\-MM\-DD\fR)
  1940. .RE
  1941. .PP
  1942. \fI%ch\fR
  1943. .RS 4
  1944. committer date, human style (like the
  1945. \fB\-\-date=human\fR
  1946. option of
  1947. \fBgit-rev-list\fR(1))
  1948. .RE
  1949. .PP
  1950. \fI%d\fR
  1951. .RS 4
  1952. ref names, like the \-\-decorate option of
  1953. \fBgit-log\fR(1)
  1954. .RE
  1955. .PP
  1956. \fI%D\fR
  1957. .RS 4
  1958. ref names without the " (", ")" wrapping\&.
  1959. .RE
  1960. .PP
  1961. \fI%(decorate[:<options>])\fR
  1962. .RS 4
  1963. ref names with custom decorations\&. The
  1964. \fBdecorate\fR
  1965. string may be followed by a colon and zero or more comma\-separated options\&. Option values may contain literal formatting codes\&. These must be used for commas (%x2C) and closing parentheses (%x29), due to their role in the option syntax\&.
  1966. .sp
  1967. .RS 4
  1968. .ie n \{\
  1969. \h'-04'\(bu\h'+03'\c
  1970. .\}
  1971. .el \{\
  1972. .sp -1
  1973. .IP \(bu 2.3
  1974. .\}
  1975. \fIprefix=<value>\fR: Shown before the list of ref names\&. Defaults to "\ \&("\&.
  1976. .RE
  1977. .sp
  1978. .RS 4
  1979. .ie n \{\
  1980. \h'-04'\(bu\h'+03'\c
  1981. .\}
  1982. .el \{\
  1983. .sp -1
  1984. .IP \(bu 2.3
  1985. .\}
  1986. \fIsuffix=<value>\fR: Shown after the list of ref names\&. Defaults to ")"\&.
  1987. .RE
  1988. .sp
  1989. .RS 4
  1990. .ie n \{\
  1991. \h'-04'\(bu\h'+03'\c
  1992. .\}
  1993. .el \{\
  1994. .sp -1
  1995. .IP \(bu 2.3
  1996. .\}
  1997. \fIseparator=<value>\fR: Shown between ref names\&. Defaults to "\fB,\fR\ \&"\&.
  1998. .RE
  1999. .sp
  2000. .RS 4
  2001. .ie n \{\
  2002. \h'-04'\(bu\h'+03'\c
  2003. .\}
  2004. .el \{\
  2005. .sp -1
  2006. .IP \(bu 2.3
  2007. .\}
  2008. \fIpointer=<value>\fR: Shown between HEAD and the branch it points to, if any\&. Defaults to "\ \&\fB\-\fR>\ \&"\&.
  2009. .RE
  2010. .sp
  2011. .RS 4
  2012. .ie n \{\
  2013. \h'-04'\(bu\h'+03'\c
  2014. .\}
  2015. .el \{\
  2016. .sp -1
  2017. .IP \(bu 2.3
  2018. .\}
  2019. \fItag=<value>\fR: Shown before tag names\&. Defaults to "\fBtag:\fR\ \&"\&.
  2020. .RE
  2021. .RE
  2022. .RE
  2023. .sp
  2024. For example, to produce decorations with no wrapping or tag annotations, and spaces as separators:
  2025. .sp
  2026. + %(\fBdecorate:prefix=,suffix=,tag=,separator=\fR
  2027. )
  2028. .PP
  2029. \fI%(describe[:<options>])\fR
  2030. .RS 4
  2031. human\-readable name, like
  2032. \fBgit-describe\fR(1); empty string for undescribable commits\&. The
  2033. \fBdescribe\fR
  2034. string may be followed by a colon and zero or more comma\-separated options\&. Descriptions can be inconsistent when tags are added or removed at the same time\&.
  2035. .sp
  2036. .RS 4
  2037. .ie n \{\
  2038. \h'-04'\(bu\h'+03'\c
  2039. .\}
  2040. .el \{\
  2041. .sp -1
  2042. .IP \(bu 2.3
  2043. .\}
  2044. \fItags[=<bool\-value>]\fR: Instead of only considering annotated tags, consider lightweight tags as well\&.
  2045. .RE
  2046. .sp
  2047. .RS 4
  2048. .ie n \{\
  2049. \h'-04'\(bu\h'+03'\c
  2050. .\}
  2051. .el \{\
  2052. .sp -1
  2053. .IP \(bu 2.3
  2054. .\}
  2055. \fIabbrev=<number>\fR: Instead of using the default number of hexadecimal digits (which will vary according to the number of objects in the repository with a default of 7) of the abbreviated object name, use <number> digits, or as many digits as needed to form a unique object name\&.
  2056. .RE
  2057. .sp
  2058. .RS 4
  2059. .ie n \{\
  2060. \h'-04'\(bu\h'+03'\c
  2061. .\}
  2062. .el \{\
  2063. .sp -1
  2064. .IP \(bu 2.3
  2065. .\}
  2066. \fImatch=<pattern>\fR: Only consider tags matching the given
  2067. \fBglob\fR(\fB7\fR) pattern, excluding the "refs/tags/" prefix\&.
  2068. .RE
  2069. .sp
  2070. .RS 4
  2071. .ie n \{\
  2072. \h'-04'\(bu\h'+03'\c
  2073. .\}
  2074. .el \{\
  2075. .sp -1
  2076. .IP \(bu 2.3
  2077. .\}
  2078. \fIexclude=<pattern>\fR: Do not consider tags matching the given
  2079. \fBglob\fR(\fB7\fR) pattern, excluding the "refs/tags/" prefix\&.
  2080. .RE
  2081. .RE
  2082. .PP
  2083. \fI%S\fR
  2084. .RS 4
  2085. ref name given on the command line by which the commit was reached (like
  2086. \fBgit\fR
  2087. \fBlog\fR
  2088. \fB\-\-source\fR), only works with
  2089. \fBgit\fR
  2090. \fBlog\fR
  2091. .RE
  2092. .PP
  2093. \fI%e\fR
  2094. .RS 4
  2095. encoding
  2096. .RE
  2097. .PP
  2098. \fI%s\fR
  2099. .RS 4
  2100. subject
  2101. .RE
  2102. .PP
  2103. \fI%f\fR
  2104. .RS 4
  2105. sanitized subject line, suitable for a filename
  2106. .RE
  2107. .PP
  2108. \fI%b\fR
  2109. .RS 4
  2110. body
  2111. .RE
  2112. .PP
  2113. \fI%B\fR
  2114. .RS 4
  2115. raw body (unwrapped subject and body)
  2116. .RE
  2117. .PP
  2118. \fI%N\fR
  2119. .RS 4
  2120. commit notes
  2121. .RE
  2122. .PP
  2123. \fI%GG\fR
  2124. .RS 4
  2125. raw verification message from GPG for a signed commit
  2126. .RE
  2127. .PP
  2128. \fI%G?\fR
  2129. .RS 4
  2130. show "G" for a good (valid) signature, "B" for a bad signature, "U" for a good signature with unknown validity, "X" for a good signature that has expired, "Y" for a good signature made by an expired key, "R" for a good signature made by a revoked key, "E" if the signature cannot be checked (e\&.g\&. missing key) and "N" for no signature
  2131. .RE
  2132. .PP
  2133. \fI%GS\fR
  2134. .RS 4
  2135. show the name of the signer for a signed commit
  2136. .RE
  2137. .PP
  2138. \fI%GK\fR
  2139. .RS 4
  2140. show the key used to sign a signed commit
  2141. .RE
  2142. .PP
  2143. \fI%GF\fR
  2144. .RS 4
  2145. show the fingerprint of the key used to sign a signed commit
  2146. .RE
  2147. .PP
  2148. \fI%GP\fR
  2149. .RS 4
  2150. show the fingerprint of the primary key whose subkey was used to sign a signed commit
  2151. .RE
  2152. .PP
  2153. \fI%GT\fR
  2154. .RS 4
  2155. show the trust level for the key used to sign a signed commit
  2156. .RE
  2157. .PP
  2158. \fI%gD\fR
  2159. .RS 4
  2160. reflog selector, e\&.g\&.,
  2161. \fBrefs/stash@\fR{1} or
  2162. \fBrefs/stash@\fR{2
  2163. \fBminutes\fR
  2164. \fBago\fR}; the format follows the rules described for the
  2165. \fB\-g\fR
  2166. option\&. The portion before the
  2167. \fB@\fR
  2168. is the refname as given on the command line (so
  2169. \fBgit\fR
  2170. \fBlog\fR
  2171. \fB\-g\fR
  2172. \fBrefs/heads/master\fR
  2173. would yield
  2174. \fBrefs/heads/master@\fR{0})\&.
  2175. .RE
  2176. .PP
  2177. \fI%gd\fR
  2178. .RS 4
  2179. shortened reflog selector; same as %gD, but the refname portion is shortened for human readability (so
  2180. \fBrefs/heads/master\fR
  2181. becomes just
  2182. \fBmaster\fR)\&.
  2183. .RE
  2184. .PP
  2185. \fI%gn\fR
  2186. .RS 4
  2187. reflog identity name
  2188. .RE
  2189. .PP
  2190. \fI%gN\fR
  2191. .RS 4
  2192. reflog identity name (respecting \&.mailmap, see
  2193. \fBgit-shortlog\fR(1)
  2194. or
  2195. \fBgit-blame\fR(1))
  2196. .RE
  2197. .PP
  2198. \fI%ge\fR
  2199. .RS 4
  2200. reflog identity email
  2201. .RE
  2202. .PP
  2203. \fI%gE\fR
  2204. .RS 4
  2205. reflog identity email (respecting \&.mailmap, see
  2206. \fBgit-shortlog\fR(1)
  2207. or
  2208. \fBgit-blame\fR(1))
  2209. .RE
  2210. .PP
  2211. \fI%gs\fR
  2212. .RS 4
  2213. reflog subject
  2214. .RE
  2215. .PP
  2216. \fI%(trailers[:<options>])\fR
  2217. .RS 4
  2218. display the trailers of the body as interpreted by
  2219. \fBgit-interpret-trailers\fR(1)\&. The
  2220. \fBtrailers\fR
  2221. string may be followed by a colon and zero or more comma\-separated options\&. If any option is provided multiple times, the last occurrence wins\&.
  2222. .sp
  2223. .RS 4
  2224. .ie n \{\
  2225. \h'-04'\(bu\h'+03'\c
  2226. .\}
  2227. .el \{\
  2228. .sp -1
  2229. .IP \(bu 2.3
  2230. .\}
  2231. \fIkey=<key>\fR: only show trailers with specified <key>\&. Matching is done case\-insensitively and trailing colon is optional\&. If option is given multiple times trailer lines matching any of the keys are shown\&. This option automatically enables the
  2232. \fBonly\fR
  2233. option so that non\-trailer lines in the trailer block are hidden\&. If that is not desired it can be disabled with
  2234. \fBonly=false\fR\&. E\&.g\&., %(\fBtrailers:key=Reviewed\-by\fR) shows trailer lines with key
  2235. \fBReviewed\-by\fR\&.
  2236. .RE
  2237. .sp
  2238. .RS 4
  2239. .ie n \{\
  2240. \h'-04'\(bu\h'+03'\c
  2241. .\}
  2242. .el \{\
  2243. .sp -1
  2244. .IP \(bu 2.3
  2245. .\}
  2246. \fIonly[=<bool>]\fR: select whether non\-trailer lines from the trailer block should be included\&.
  2247. .RE
  2248. .sp
  2249. .RS 4
  2250. .ie n \{\
  2251. \h'-04'\(bu\h'+03'\c
  2252. .\}
  2253. .el \{\
  2254. .sp -1
  2255. .IP \(bu 2.3
  2256. .\}
  2257. \fIseparator=<sep>\fR: specify the separator inserted between trailer lines\&. Defaults to a line feed character\&. The string <sep> may contain the literal formatting codes described above\&. To use comma as separator one must use %x2C as it would otherwise be parsed as next option\&. E\&.g\&., %(\fBtrailers:key=Ticket,separator=\fR%x2C ) shows all trailer lines whose key is "Ticket" separated by a comma and a space\&.
  2258. .RE
  2259. .sp
  2260. .RS 4
  2261. .ie n \{\
  2262. \h'-04'\(bu\h'+03'\c
  2263. .\}
  2264. .el \{\
  2265. .sp -1
  2266. .IP \(bu 2.3
  2267. .\}
  2268. \fIunfold[=<bool>]\fR: make it behave as if interpret\-trailer\(cqs
  2269. \fB\-\-unfold\fR
  2270. option was given\&. E\&.g\&., %(\fBtrailers:only,unfold=true\fR) unfolds and shows all trailer lines\&.
  2271. .RE
  2272. .sp
  2273. .RS 4
  2274. .ie n \{\
  2275. \h'-04'\(bu\h'+03'\c
  2276. .\}
  2277. .el \{\
  2278. .sp -1
  2279. .IP \(bu 2.3
  2280. .\}
  2281. \fIkeyonly[=<bool>]\fR: only show the key part of the trailer\&.
  2282. .RE
  2283. .sp
  2284. .RS 4
  2285. .ie n \{\
  2286. \h'-04'\(bu\h'+03'\c
  2287. .\}
  2288. .el \{\
  2289. .sp -1
  2290. .IP \(bu 2.3
  2291. .\}
  2292. \fIvalueonly[=<bool>]\fR: only show the value part of the trailer\&.
  2293. .RE
  2294. .sp
  2295. .RS 4
  2296. .ie n \{\
  2297. \h'-04'\(bu\h'+03'\c
  2298. .\}
  2299. .el \{\
  2300. .sp -1
  2301. .IP \(bu 2.3
  2302. .\}
  2303. \fIkey_value_separator=<sep>\fR: specify the separator inserted between the key and value of each trailer\&. Defaults to ": "\&. Otherwise it shares the same semantics as
  2304. \fIseparator=<sep>\fR
  2305. above\&.
  2306. .RE
  2307. .RE
  2308. .RE
  2309. .if n \{\
  2310. .sp
  2311. .\}
  2312. .RS 4
  2313. .it 1 an-trap
  2314. .nr an-no-space-flag 1
  2315. .nr an-break-flag 1
  2316. .br
  2317. .ps +1
  2318. \fBNote\fR
  2319. .ps -1
  2320. .br
  2321. .sp
  2322. Some placeholders may depend on other options given to the revision traversal engine\&. For example, the %g* reflog options will insert an empty string unless we are traversing reflog entries (e\&.g\&., by \fBgit\fR \fBlog\fR \fB\-g\fR)\&. The %d and %D placeholders will use the "short" decoration format if \fB\-\-decorate\fR was not already provided on the command line\&.
  2323. .sp .5v
  2324. .RE
  2325. .sp
  2326. The boolean options accept an optional value [\fB=\fR\fI<bool\-value>\fR]\&. The values taken by \fB\-\-type=bool\fR git\-config[1], like \fByes\fR and \fBoff\fR, are all accepted\&. Giving a boolean option without \fB=\fR\fI<value>\fR is equivalent to giving it with \fB=true\fR\&.
  2327. .sp
  2328. If you add a \fB+\fR (plus sign) after \fI%\fR of a placeholder, a line\-feed is inserted immediately before the expansion if and only if the placeholder expands to a non\-empty string\&.
  2329. .sp
  2330. If you add a \fB\-\fR (minus sign) after \fI%\fR of a placeholder, all consecutive line\-feeds immediately preceding the expansion are deleted if and only if the placeholder expands to an empty string\&.
  2331. .sp
  2332. If you add a ` ` (space) after \fI%\fR of a placeholder, a space is inserted immediately before the expansion if and only if the placeholder expands to a non\-empty string\&.
  2333. .sp
  2334. .RS 4
  2335. .ie n \{\
  2336. \h'-04'\(bu\h'+03'\c
  2337. .\}
  2338. .el \{\
  2339. .sp -1
  2340. .IP \(bu 2.3
  2341. .\}
  2342. \fItformat:\fR
  2343. .sp
  2344. The
  2345. \fItformat:\fR
  2346. format works exactly like
  2347. \fIformat:\fR, except that it provides "terminator" semantics instead of "separator" semantics\&. In other words, each commit has the message terminator character (usually a newline) appended, rather than a separator placed between entries\&. This means that the final entry of a single\-line format will be properly terminated with a new line, just as the "oneline" format does\&. For example:
  2348. .sp
  2349. .if n \{\
  2350. .RS 4
  2351. .\}
  2352. .nf
  2353. $ git log \-2 \-\-pretty=format:%h 4da45bef \e
  2354. | perl \-pe \*(Aq$_ \&.= " \-\- NO NEWLINE\en" unless /\en/\*(Aq
  2355. 4da45be
  2356. 7134973 \-\- NO NEWLINE
  2357. $ git log \-2 \-\-pretty=tformat:%h 4da45bef \e
  2358. | perl \-pe \*(Aq$_ \&.= " \-\- NO NEWLINE\en" unless /\en/\*(Aq
  2359. 4da45be
  2360. 7134973
  2361. .fi
  2362. .if n \{\
  2363. .RE
  2364. .\}
  2365. .sp
  2366. In addition, any unrecognized string that has a % in it is interpreted as if it has
  2367. \fBtformat:\fR
  2368. in front of it\&. For example, these two are equivalent:
  2369. .sp
  2370. .if n \{\
  2371. .RS 4
  2372. .\}
  2373. .nf
  2374. $ git log \-2 \-\-pretty=tformat:%h 4da45bef
  2375. $ git log \-2 \-\-pretty=%h 4da45bef
  2376. .fi
  2377. .if n \{\
  2378. .RE
  2379. .\}
  2380. .RE
  2381. .SH "RAW OUTPUT FORMAT"
  2382. .sp
  2383. The raw output format from \fBgit\-diff\-index\fR, \fBgit\-diff\-tree\fR, \fBgit\-diff\-files\fR and \fBgit\fR \fBdiff\fR \fB\-\-raw\fR are very similar\&.
  2384. .sp
  2385. These commands all compare two sets of things; what is compared differs:
  2386. .PP
  2387. \fBgit\-diff\-index\fR \fI<tree\-ish>\fR
  2388. .RS 4
  2389. compares the
  2390. \fI<tree\-ish>\fR
  2391. and the files on the filesystem\&.
  2392. .RE
  2393. .PP
  2394. \fBgit\-diff\-index\fR \fB\-\-cached\fR \fI<tree\-ish>\fR
  2395. .RS 4
  2396. compares the
  2397. \fI<tree\-ish>\fR
  2398. and the index\&.
  2399. .RE
  2400. .PP
  2401. \fBgit\-diff\-tree\fR [\fB\-r\fR] \fI<tree\-ish\-1>\fR \fI<tree\-ish\-2>\fR [\fI<pattern>\fR\&.\&.\&.]
  2402. .RS 4
  2403. compares the trees named by the two arguments\&.
  2404. .RE
  2405. .PP
  2406. \fBgit\-diff\-files\fR [\fI<pattern>\fR\&.\&.\&.]
  2407. .RS 4
  2408. compares the index and the files on the filesystem\&.
  2409. .RE
  2410. .sp
  2411. The \fBgit\-diff\-tree\fR command begins its output by printing the hash of what is being compared\&. After that, all the commands print one output line per changed file\&.
  2412. .sp
  2413. An output line is formatted this way:
  2414. .sp
  2415. .if n \{\
  2416. .RS 4
  2417. .\}
  2418. .nf
  2419. in\-place edit :100644 100644 bcd1234 0123456 M file0
  2420. copy\-edit :100644 100644 abcd123 1234567 C68 file1 file2
  2421. rename\-edit :100644 100644 abcd123 1234567 R86 file1 file3
  2422. create :000000 100644 0000000 1234567 A file4
  2423. delete :100644 000000 1234567 0000000 D file5
  2424. unmerged :000000 000000 0000000 0000000 U file6
  2425. .fi
  2426. .if n \{\
  2427. .RE
  2428. .\}
  2429. .sp
  2430. That is, from the left to the right:
  2431. .sp
  2432. .RS 4
  2433. .ie n \{\
  2434. \h'-04' 1.\h'+01'\c
  2435. .\}
  2436. .el \{\
  2437. .sp -1
  2438. .IP " 1." 4.2
  2439. .\}
  2440. a colon\&.
  2441. .RE
  2442. .sp
  2443. .RS 4
  2444. .ie n \{\
  2445. \h'-04' 2.\h'+01'\c
  2446. .\}
  2447. .el \{\
  2448. .sp -1
  2449. .IP " 2." 4.2
  2450. .\}
  2451. mode for "src"; 000000 if creation or unmerged\&.
  2452. .RE
  2453. .sp
  2454. .RS 4
  2455. .ie n \{\
  2456. \h'-04' 3.\h'+01'\c
  2457. .\}
  2458. .el \{\
  2459. .sp -1
  2460. .IP " 3." 4.2
  2461. .\}
  2462. a space\&.
  2463. .RE
  2464. .sp
  2465. .RS 4
  2466. .ie n \{\
  2467. \h'-04' 4.\h'+01'\c
  2468. .\}
  2469. .el \{\
  2470. .sp -1
  2471. .IP " 4." 4.2
  2472. .\}
  2473. mode for "dst"; 000000 if deletion or unmerged\&.
  2474. .RE
  2475. .sp
  2476. .RS 4
  2477. .ie n \{\
  2478. \h'-04' 5.\h'+01'\c
  2479. .\}
  2480. .el \{\
  2481. .sp -1
  2482. .IP " 5." 4.2
  2483. .\}
  2484. a space\&.
  2485. .RE
  2486. .sp
  2487. .RS 4
  2488. .ie n \{\
  2489. \h'-04' 6.\h'+01'\c
  2490. .\}
  2491. .el \{\
  2492. .sp -1
  2493. .IP " 6." 4.2
  2494. .\}
  2495. sha1 for "src"; 0{40} if creation or unmerged\&.
  2496. .RE
  2497. .sp
  2498. .RS 4
  2499. .ie n \{\
  2500. \h'-04' 7.\h'+01'\c
  2501. .\}
  2502. .el \{\
  2503. .sp -1
  2504. .IP " 7." 4.2
  2505. .\}
  2506. a space\&.
  2507. .RE
  2508. .sp
  2509. .RS 4
  2510. .ie n \{\
  2511. \h'-04' 8.\h'+01'\c
  2512. .\}
  2513. .el \{\
  2514. .sp -1
  2515. .IP " 8." 4.2
  2516. .\}
  2517. sha1 for "dst"; 0{40} if deletion, unmerged or "work tree out of sync with the index"\&.
  2518. .RE
  2519. .sp
  2520. .RS 4
  2521. .ie n \{\
  2522. \h'-04' 9.\h'+01'\c
  2523. .\}
  2524. .el \{\
  2525. .sp -1
  2526. .IP " 9." 4.2
  2527. .\}
  2528. a space\&.
  2529. .RE
  2530. .sp
  2531. .RS 4
  2532. .ie n \{\
  2533. \h'-04'10.\h'+01'\c
  2534. .\}
  2535. .el \{\
  2536. .sp -1
  2537. .IP "10." 4.2
  2538. .\}
  2539. status, followed by optional "score" number\&.
  2540. .RE
  2541. .sp
  2542. .RS 4
  2543. .ie n \{\
  2544. \h'-04'11.\h'+01'\c
  2545. .\}
  2546. .el \{\
  2547. .sp -1
  2548. .IP "11." 4.2
  2549. .\}
  2550. a tab or a NUL when
  2551. \fB\-z\fR
  2552. option is used\&.
  2553. .RE
  2554. .sp
  2555. .RS 4
  2556. .ie n \{\
  2557. \h'-04'12.\h'+01'\c
  2558. .\}
  2559. .el \{\
  2560. .sp -1
  2561. .IP "12." 4.2
  2562. .\}
  2563. path for "src"
  2564. .RE
  2565. .sp
  2566. .RS 4
  2567. .ie n \{\
  2568. \h'-04'13.\h'+01'\c
  2569. .\}
  2570. .el \{\
  2571. .sp -1
  2572. .IP "13." 4.2
  2573. .\}
  2574. a tab or a NUL when
  2575. \fB\-z\fR
  2576. option is used; only exists for C or R\&.
  2577. .RE
  2578. .sp
  2579. .RS 4
  2580. .ie n \{\
  2581. \h'-04'14.\h'+01'\c
  2582. .\}
  2583. .el \{\
  2584. .sp -1
  2585. .IP "14." 4.2
  2586. .\}
  2587. path for "dst"; only exists for C or R\&.
  2588. .RE
  2589. .sp
  2590. .RS 4
  2591. .ie n \{\
  2592. \h'-04'15.\h'+01'\c
  2593. .\}
  2594. .el \{\
  2595. .sp -1
  2596. .IP "15." 4.2
  2597. .\}
  2598. an LF or a NUL when
  2599. \fB\-z\fR
  2600. option is used, to terminate the record\&.
  2601. .RE
  2602. .sp
  2603. Possible status letters are:
  2604. .sp
  2605. .RS 4
  2606. .ie n \{\
  2607. \h'-04'\(bu\h'+03'\c
  2608. .\}
  2609. .el \{\
  2610. .sp -1
  2611. .IP \(bu 2.3
  2612. .\}
  2613. \fBA\fR: addition of a file
  2614. .RE
  2615. .sp
  2616. .RS 4
  2617. .ie n \{\
  2618. \h'-04'\(bu\h'+03'\c
  2619. .\}
  2620. .el \{\
  2621. .sp -1
  2622. .IP \(bu 2.3
  2623. .\}
  2624. \fBC\fR: copy of a file into a new one
  2625. .RE
  2626. .sp
  2627. .RS 4
  2628. .ie n \{\
  2629. \h'-04'\(bu\h'+03'\c
  2630. .\}
  2631. .el \{\
  2632. .sp -1
  2633. .IP \(bu 2.3
  2634. .\}
  2635. \fBD\fR: deletion of a file
  2636. .RE
  2637. .sp
  2638. .RS 4
  2639. .ie n \{\
  2640. \h'-04'\(bu\h'+03'\c
  2641. .\}
  2642. .el \{\
  2643. .sp -1
  2644. .IP \(bu 2.3
  2645. .\}
  2646. \fBM\fR: modification of the contents or mode of a file
  2647. .RE
  2648. .sp
  2649. .RS 4
  2650. .ie n \{\
  2651. \h'-04'\(bu\h'+03'\c
  2652. .\}
  2653. .el \{\
  2654. .sp -1
  2655. .IP \(bu 2.3
  2656. .\}
  2657. \fBR\fR: renaming of a file
  2658. .RE
  2659. .sp
  2660. .RS 4
  2661. .ie n \{\
  2662. \h'-04'\(bu\h'+03'\c
  2663. .\}
  2664. .el \{\
  2665. .sp -1
  2666. .IP \(bu 2.3
  2667. .\}
  2668. \fBT\fR: change in the type of the file (regular file, symbolic link or submodule)
  2669. .RE
  2670. .sp
  2671. .RS 4
  2672. .ie n \{\
  2673. \h'-04'\(bu\h'+03'\c
  2674. .\}
  2675. .el \{\
  2676. .sp -1
  2677. .IP \(bu 2.3
  2678. .\}
  2679. \fBU\fR: file is unmerged (you must complete the merge before it can be committed)
  2680. .RE
  2681. .sp
  2682. .RS 4
  2683. .ie n \{\
  2684. \h'-04'\(bu\h'+03'\c
  2685. .\}
  2686. .el \{\
  2687. .sp -1
  2688. .IP \(bu 2.3
  2689. .\}
  2690. \fBX\fR: "unknown" change type (most probably a bug, please report it)
  2691. .RE
  2692. .sp
  2693. Status letters \fBC\fR and \fBR\fR are always followed by a score (denoting the percentage of similarity between the source and target of the move or copy)\&. Status letter \fBM\fR may be followed by a score (denoting the percentage of dissimilarity) for file rewrites\&.
  2694. .sp
  2695. The sha1 for "dst" is shown as all 0\(cqs if a file on the filesystem is out of sync with the index\&.
  2696. .sp
  2697. Example:
  2698. .sp
  2699. .if n \{\
  2700. .RS 4
  2701. .\}
  2702. .nf
  2703. :100644 100644 5be4a4a 0000000 M file\&.c
  2704. .fi
  2705. .if n \{\
  2706. .RE
  2707. .\}
  2708. .sp
  2709. Without the \fB\-z\fR option, pathnames with "unusual" characters are quoted as explained for the configuration variable \fBcore\&.quotePath\fR (see \fBgit-config\fR(1))\&. Using \fB\-z\fR the filename is output verbatim and the line is terminated by a NUL byte\&.
  2710. .SH "DIFF FORMAT FOR MERGES"
  2711. .sp
  2712. \fBgit\-diff\-tree\fR, \fBgit\-diff\-files\fR and \fBgit\-diff\fR \fB\-\-raw\fR can take \fB\-c\fR or \fB\-\-cc\fR option to generate diff output also for merge commits\&. The output differs from the format described above in the following way:
  2713. .sp
  2714. .RS 4
  2715. .ie n \{\
  2716. \h'-04' 1.\h'+01'\c
  2717. .\}
  2718. .el \{\
  2719. .sp -1
  2720. .IP " 1." 4.2
  2721. .\}
  2722. there is a colon for each parent
  2723. .RE
  2724. .sp
  2725. .RS 4
  2726. .ie n \{\
  2727. \h'-04' 2.\h'+01'\c
  2728. .\}
  2729. .el \{\
  2730. .sp -1
  2731. .IP " 2." 4.2
  2732. .\}
  2733. there are more "src" modes and "src" sha1
  2734. .RE
  2735. .sp
  2736. .RS 4
  2737. .ie n \{\
  2738. \h'-04' 3.\h'+01'\c
  2739. .\}
  2740. .el \{\
  2741. .sp -1
  2742. .IP " 3." 4.2
  2743. .\}
  2744. status is concatenated status characters for each parent
  2745. .RE
  2746. .sp
  2747. .RS 4
  2748. .ie n \{\
  2749. \h'-04' 4.\h'+01'\c
  2750. .\}
  2751. .el \{\
  2752. .sp -1
  2753. .IP " 4." 4.2
  2754. .\}
  2755. no optional "score" number
  2756. .RE
  2757. .sp
  2758. .RS 4
  2759. .ie n \{\
  2760. \h'-04' 5.\h'+01'\c
  2761. .\}
  2762. .el \{\
  2763. .sp -1
  2764. .IP " 5." 4.2
  2765. .\}
  2766. tab\-separated pathname(s) of the file
  2767. .RE
  2768. .sp
  2769. For \fB\-c\fR and \fB\-\-cc\fR, only the destination or final path is shown even if the file was renamed on any side of history\&. With \fB\-\-combined\-all\-paths\fR, the name of the path in each parent is shown followed by the name of the path in the merge commit\&.
  2770. .sp
  2771. Examples for \fB\-c\fR and \fB\-\-cc\fR without \fB\-\-combined\-all\-paths\fR:
  2772. .sp
  2773. .if n \{\
  2774. .RS 4
  2775. .\}
  2776. .nf
  2777. ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc\&.c
  2778. ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM bar\&.sh
  2779. ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR phooey\&.c
  2780. .fi
  2781. .if n \{\
  2782. .RE
  2783. .\}
  2784. .sp
  2785. Examples when \fB\-\-combined\-all\-paths\fR added to either \fB\-c\fR or \fB\-\-cc\fR:
  2786. .sp
  2787. .if n \{\
  2788. .RS 4
  2789. .\}
  2790. .nf
  2791. ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc\&.c desc\&.c desc\&.c
  2792. ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM foo\&.sh bar\&.sh bar\&.sh
  2793. ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR fooey\&.c fuey\&.c phooey\&.c
  2794. .fi
  2795. .if n \{\
  2796. .RE
  2797. .\}
  2798. .sp
  2799. Note that \fIcombined diff\fR lists only files which were modified from all parents\&.
  2800. .SH "GENERATING PATCH TEXT WITH \-P"
  2801. .sp
  2802. Running \fBgit-diff\fR(1), \fBgit-log\fR(1), \fBgit-show\fR(1), \fBgit-diff-index\fR(1), \fBgit-diff-tree\fR(1), or \fBgit-diff-files\fR(1) with the \fB\-p\fR option produces patch text\&. You can customize the creation of patch text via the \fBGIT_EXTERNAL_DIFF\fR and the \fBGIT_DIFF_OPTS\fR environment variables (see \fBgit\fR(1)), and the \fBdiff\fR attribute (see \fBgitattributes\fR(5))\&.
  2803. .sp
  2804. What the \fB\-p\fR option produces is slightly different from the traditional diff format:
  2805. .sp
  2806. .RS 4
  2807. .ie n \{\
  2808. \h'-04' 1.\h'+01'\c
  2809. .\}
  2810. .el \{\
  2811. .sp -1
  2812. .IP " 1." 4.2
  2813. .\}
  2814. It is preceded by a "git diff" header that looks like this:
  2815. .sp
  2816. .if n \{\
  2817. .RS 4
  2818. .\}
  2819. .nf
  2820. diff \-\-git a/file1 b/file2
  2821. .fi
  2822. .if n \{\
  2823. .RE
  2824. .\}
  2825. .sp
  2826. The
  2827. \fBa/\fR
  2828. and
  2829. \fBb/\fR
  2830. filenames are the same unless rename/copy is involved\&. Especially, even for a creation or a deletion,
  2831. \fB/dev/null\fR
  2832. is
  2833. \fInot\fR
  2834. used in place of the
  2835. \fBa/\fR
  2836. or
  2837. \fBb/\fR
  2838. filenames\&.
  2839. .sp
  2840. When a rename/copy is involved,
  2841. \fBfile1\fR
  2842. and
  2843. \fBfile2\fR
  2844. show the name of the source file of the rename/copy and the name of the file that the rename/copy produces, respectively\&.
  2845. .RE
  2846. .sp
  2847. .RS 4
  2848. .ie n \{\
  2849. \h'-04' 2.\h'+01'\c
  2850. .\}
  2851. .el \{\
  2852. .sp -1
  2853. .IP " 2." 4.2
  2854. .\}
  2855. It is followed by one or more extended header lines:
  2856. .sp
  2857. .if n \{\
  2858. .RS 4
  2859. .\}
  2860. .nf
  2861. \fBold\fR \fBmode\fR \fI<mode>\fR
  2862. \fBnew\fR \fBmode\fR \fI<mode>\fR
  2863. \fBdeleted\fR \fBfile\fR \fBmode\fR \fI<mode>\fR
  2864. \fBnew\fR \fBfile\fR \fBmode\fR \fI<mode>\fR
  2865. \fBcopy\fR \fBfrom\fR \fI<path>\fR
  2866. \fBcopy\fR \fBto\fR \fI<path>\fR
  2867. \fBrename\fR \fBfrom\fR \fI<path>\fR
  2868. \fBrename\fR \fBto\fR \fI<path>\fR
  2869. \fBsimilarity\fR \fBindex\fR \fI<number>\fR
  2870. \fBdissimilarity\fR \fBindex\fR \fI<number>\fR
  2871. \fBindex\fR \fI<hash>\fR`\&.\&.`\fI<hash>\fR \fI<mode>\fR
  2872. .fi
  2873. .if n \{\
  2874. .RE
  2875. .\}
  2876. File modes
  2877. \fI<mode>\fR
  2878. are printed as 6\-digit octal numbers including the file type and file permission bits\&.
  2879. .sp
  2880. Path names in extended headers do not include the
  2881. \fBa/\fR
  2882. and
  2883. \fBb/\fR
  2884. prefixes\&.
  2885. .sp
  2886. The similarity index is the percentage of unchanged lines, and the dissimilarity index is the percentage of changed lines\&. It is a rounded down integer, followed by a percent sign\&. The similarity index value of 100% is thus reserved for two equal files, while 100% dissimilarity means that no line from the old file made it into the new one\&.
  2887. .sp
  2888. The index line includes the blob object names before and after the change\&. The
  2889. \fI<mode>\fR
  2890. is included if the file mode does not change; otherwise, separate lines indicate the old and the new mode\&.
  2891. .RE
  2892. .sp
  2893. .RS 4
  2894. .ie n \{\
  2895. \h'-04' 3.\h'+01'\c
  2896. .\}
  2897. .el \{\
  2898. .sp -1
  2899. .IP " 3." 4.2
  2900. .\}
  2901. Pathnames with "unusual" characters are quoted as explained for the configuration variable
  2902. \fBcore\&.quotePath\fR
  2903. (see
  2904. \fBgit-config\fR(1))\&.
  2905. .RE
  2906. .sp
  2907. .RS 4
  2908. .ie n \{\
  2909. \h'-04' 4.\h'+01'\c
  2910. .\}
  2911. .el \{\
  2912. .sp -1
  2913. .IP " 4." 4.2
  2914. .\}
  2915. All the
  2916. \fBfile1\fR
  2917. files in the output refer to files before the commit, and all the
  2918. \fBfile2\fR
  2919. files refer to files after the commit\&. It is incorrect to apply each change to each file sequentially\&. For example, this patch will swap a and b:
  2920. .sp
  2921. .if n \{\
  2922. .RS 4
  2923. .\}
  2924. .nf
  2925. diff \-\-git a/a b/b
  2926. rename from a
  2927. rename to b
  2928. diff \-\-git a/b b/a
  2929. rename from b
  2930. rename to a
  2931. .fi
  2932. .if n \{\
  2933. .RE
  2934. .\}
  2935. .RE
  2936. .sp
  2937. .RS 4
  2938. .ie n \{\
  2939. \h'-04' 5.\h'+01'\c
  2940. .\}
  2941. .el \{\
  2942. .sp -1
  2943. .IP " 5." 4.2
  2944. .\}
  2945. Hunk headers mention the name of the function to which the hunk applies\&. See "Defining a custom hunk\-header" in
  2946. \fBgitattributes\fR(5)
  2947. for details of how to tailor this to specific languages\&.
  2948. .RE
  2949. .SH "COMBINED DIFF FORMAT"
  2950. .sp
  2951. Any diff\-generating command can take the \fB\-c\fR or \fB\-\-cc\fR option to produce a \fIcombined diff\fR when showing a merge\&. This is the default format when showing merges with \fBgit-diff\fR(1) or \fBgit-show\fR(1)\&. Note also that you can give suitable \fB\-\-diff\-merges\fR option to any of these commands to force generation of diffs in a specific format\&.
  2952. .sp
  2953. A "combined diff" format looks like this:
  2954. .sp
  2955. .if n \{\
  2956. .RS 4
  2957. .\}
  2958. .nf
  2959. diff \-\-combined describe\&.c
  2960. index fabadb8,cc95eb0\&.\&.4866510
  2961. \-\-\- a/describe\&.c
  2962. +++ b/describe\&.c
  2963. @@@ \-98,20 \-98,12 +98,20 @@@
  2964. return (a_date > b_date) ? \-1 : (a_date == b_date) ? 0 : 1;
  2965. }
  2966. \- static void describe(char *arg)
  2967. \-static void describe(struct commit *cmit, int last_one)
  2968. ++static void describe(char *arg, int last_one)
  2969. {
  2970. + unsigned char sha1[20];
  2971. + struct commit *cmit;
  2972. struct commit_list *list;
  2973. static int initialized = 0;
  2974. struct commit_name *n;
  2975. + if (get_sha1(arg, sha1) < 0)
  2976. + usage(describe_usage);
  2977. + cmit = lookup_commit_reference(sha1);
  2978. + if (!cmit)
  2979. + usage(describe_usage);
  2980. +
  2981. if (!initialized) {
  2982. initialized = 1;
  2983. for_each_ref(get_name);
  2984. .fi
  2985. .if n \{\
  2986. .RE
  2987. .\}
  2988. .sp
  2989. .RS 4
  2990. .ie n \{\
  2991. \h'-04' 1.\h'+01'\c
  2992. .\}
  2993. .el \{\
  2994. .sp -1
  2995. .IP " 1." 4.2
  2996. .\}
  2997. It is preceded by a "git diff" header, that looks like this (when the
  2998. \fB\-c\fR
  2999. option is used):
  3000. .sp
  3001. .if n \{\
  3002. .RS 4
  3003. .\}
  3004. .nf
  3005. diff \-\-combined file
  3006. .fi
  3007. .if n \{\
  3008. .RE
  3009. .\}
  3010. .sp
  3011. or like this (when the
  3012. \fB\-\-cc\fR
  3013. option is used):
  3014. .sp
  3015. .if n \{\
  3016. .RS 4
  3017. .\}
  3018. .nf
  3019. diff \-\-cc file
  3020. .fi
  3021. .if n \{\
  3022. .RE
  3023. .\}
  3024. .RE
  3025. .sp
  3026. .RS 4
  3027. .ie n \{\
  3028. \h'-04' 2.\h'+01'\c
  3029. .\}
  3030. .el \{\
  3031. .sp -1
  3032. .IP " 2." 4.2
  3033. .\}
  3034. It is followed by one or more extended header lines (this example shows a merge with two parents):
  3035. .sp
  3036. .if n \{\
  3037. .RS 4
  3038. .\}
  3039. .nf
  3040. \fBindex\fR \fI<hash>\fR\fB,\fR\fI<hash>\fR`\&.\&.\fB__\fR\fI<hash>\fR\fB__\fR
  3041. {empty}`mode \fI<mode>\fR\fB,\fR\fI<mode>\fR``\&.\&.``\fI<mode>\fR
  3042. \fBnew\fR \fBfile\fR \fBmode\fR \fI<mode>\fR
  3043. \fBdeleted\fR \fBfile\fR \fBmode\fR \fI<mode>\fR\fB,\fR\fI<mode>\fR
  3044. .fi
  3045. .if n \{\
  3046. .RE
  3047. .\}
  3048. The
  3049. \fBmode\fR
  3050. \fI<mode>\fR\fB,\fR\fI<mode>\fR\fB\&.\&.\fR\fI<mode>\fR
  3051. line appears only if at least one of the <mode> is different from the rest\&. Extended headers with information about detected content movement (renames and copying detection) are designed to work with the diff of two
  3052. \fI<tree\-ish>\fR
  3053. and are not used by combined diff format\&.
  3054. .RE
  3055. .sp
  3056. .RS 4
  3057. .ie n \{\
  3058. \h'-04' 3.\h'+01'\c
  3059. .\}
  3060. .el \{\
  3061. .sp -1
  3062. .IP " 3." 4.2
  3063. .\}
  3064. It is followed by a two\-line from\-file/to\-file header:
  3065. .sp
  3066. .if n \{\
  3067. .RS 4
  3068. .\}
  3069. .nf
  3070. \-\-\- a/file
  3071. +++ b/file
  3072. .fi
  3073. .if n \{\
  3074. .RE
  3075. .\}
  3076. .sp
  3077. Similar to the two\-line header for the traditional
  3078. \fIunified\fR
  3079. diff format,
  3080. \fB/dev/null\fR
  3081. is used to signal created or deleted files\&.
  3082. .sp
  3083. However, if the \-\-combined\-all\-paths option is provided, instead of a two\-line from\-file/to\-file, you get an N+1 line from\-file/to\-file header, where N is the number of parents in the merge commit:
  3084. .sp
  3085. .if n \{\
  3086. .RS 4
  3087. .\}
  3088. .nf
  3089. \-\-\- a/file
  3090. \-\-\- a/file
  3091. \-\-\- a/file
  3092. +++ b/file
  3093. .fi
  3094. .if n \{\
  3095. .RE
  3096. .\}
  3097. .sp
  3098. This extended format can be useful if rename or copy detection is active, to allow you to see the original name of the file in different parents\&.
  3099. .RE
  3100. .sp
  3101. .RS 4
  3102. .ie n \{\
  3103. \h'-04' 4.\h'+01'\c
  3104. .\}
  3105. .el \{\
  3106. .sp -1
  3107. .IP " 4." 4.2
  3108. .\}
  3109. Chunk header format is modified to prevent people from accidentally feeding it to
  3110. \fBpatch\fR
  3111. \fB\-p1\fR\&. Combined diff format was created for review of merge commit changes, and was not meant to be applied\&. The change is similar to the change in the extended
  3112. \fIindex\fR
  3113. header:
  3114. .sp
  3115. .if n \{\
  3116. .RS 4
  3117. .\}
  3118. .nf
  3119. @@@ <from\-file\-range> <from\-file\-range> <to\-file\-range> @@@
  3120. .fi
  3121. .if n \{\
  3122. .RE
  3123. .\}
  3124. .sp
  3125. There are (number of parents + 1)
  3126. \fB@\fR
  3127. characters in the chunk header for combined diff format\&.
  3128. .RE
  3129. .sp
  3130. Unlike the traditional \fIunified\fR diff format, which shows two files A and B with a single column that has \fB\-\fR (minus \(em appears in A but removed in B), \fB+\fR (plus \(em missing in A but added to B), or " " (space \(em unchanged) prefix, this format compares two or more files file1, file2,\&...\: with one file X, and shows how X differs from each of fileN\&. One column for each of fileN is prepended to the output line to note how X\(cqs line is different from it\&.
  3131. .sp
  3132. A \fB\-\fR character in the column N means that the line appears in fileN but it does not appear in the result\&. A \fB+\fR character in the column N means that the line appears in the result, and fileN does not have that line (in other words, the line was added, from the point of view of that parent)\&.
  3133. .sp
  3134. In the above example output, the function signature was changed from both files (hence two \fB\-\fR removals from both file1 and file2, plus \fB++\fR to mean one line that was added does not appear in either file1 or file2)\&. Also, eight other lines are the same from file1 but do not appear in file2 (hence prefixed with \fB+\fR)\&.
  3135. .sp
  3136. When shown by \fBgit\fR \fBdiff\-tree\fR \fB\-c\fR, it compares the parents of a merge commit with the merge result (i\&.e\&. file1\&.\&.fileN are the parents)\&. When shown by \fBgit\fR \fBdiff\-files\fR \fB\-c\fR, it compares the two unresolved merge parents with the working tree file (i\&.e\&. file1 is stage 2 aka "our version", file2 is stage 3 aka "their version")\&.
  3137. .SH "OTHER DIFF FORMATS"
  3138. .sp
  3139. The \fB\-\-summary\fR option describes newly added, deleted, renamed and copied files\&. The \fB\-\-stat\fR option adds \fBdiffstat\fR(1) graph to the output\&. These options can be combined with other options, such as \fB\-p\fR, and are meant for human consumption\&.
  3140. .sp
  3141. When showing a change that involves a rename or a copy, \fB\-\-stat\fR output formats the pathnames compactly by combining common prefix and suffix of the pathnames\&. For example, a change that moves \fBarch/i386/Makefile\fR to \fBarch/x86/Makefile\fR while modifying 4 lines will be shown like this:
  3142. .sp
  3143. .if n \{\
  3144. .RS 4
  3145. .\}
  3146. .nf
  3147. arch/{i386 => x86}/Makefile | 4 +\-\-
  3148. .fi
  3149. .if n \{\
  3150. .RE
  3151. .\}
  3152. .sp
  3153. The \fB\-\-numstat\fR option gives the diffstat(1) information but is designed for easier machine consumption\&. An entry in \fB\-\-numstat\fR output looks like this:
  3154. .sp
  3155. .if n \{\
  3156. .RS 4
  3157. .\}
  3158. .nf
  3159. 1 2 README
  3160. 3 1 arch/{i386 => x86}/Makefile
  3161. .fi
  3162. .if n \{\
  3163. .RE
  3164. .\}
  3165. .sp
  3166. That is, from left to right:
  3167. .sp
  3168. .RS 4
  3169. .ie n \{\
  3170. \h'-04' 1.\h'+01'\c
  3171. .\}
  3172. .el \{\
  3173. .sp -1
  3174. .IP " 1." 4.2
  3175. .\}
  3176. the number of added lines;
  3177. .RE
  3178. .sp
  3179. .RS 4
  3180. .ie n \{\
  3181. \h'-04' 2.\h'+01'\c
  3182. .\}
  3183. .el \{\
  3184. .sp -1
  3185. .IP " 2." 4.2
  3186. .\}
  3187. a tab;
  3188. .RE
  3189. .sp
  3190. .RS 4
  3191. .ie n \{\
  3192. \h'-04' 3.\h'+01'\c
  3193. .\}
  3194. .el \{\
  3195. .sp -1
  3196. .IP " 3." 4.2
  3197. .\}
  3198. the number of deleted lines;
  3199. .RE
  3200. .sp
  3201. .RS 4
  3202. .ie n \{\
  3203. \h'-04' 4.\h'+01'\c
  3204. .\}
  3205. .el \{\
  3206. .sp -1
  3207. .IP " 4." 4.2
  3208. .\}
  3209. a tab;
  3210. .RE
  3211. .sp
  3212. .RS 4
  3213. .ie n \{\
  3214. \h'-04' 5.\h'+01'\c
  3215. .\}
  3216. .el \{\
  3217. .sp -1
  3218. .IP " 5." 4.2
  3219. .\}
  3220. pathname (possibly with rename/copy information);
  3221. .RE
  3222. .sp
  3223. .RS 4
  3224. .ie n \{\
  3225. \h'-04' 6.\h'+01'\c
  3226. .\}
  3227. .el \{\
  3228. .sp -1
  3229. .IP " 6." 4.2
  3230. .\}
  3231. a newline\&.
  3232. .RE
  3233. .sp
  3234. When \fB\-z\fR output option is in effect, the output is formatted this way:
  3235. .sp
  3236. .if n \{\
  3237. .RS 4
  3238. .\}
  3239. .nf
  3240. 1 2 README NUL
  3241. 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL
  3242. .fi
  3243. .if n \{\
  3244. .RE
  3245. .\}
  3246. .sp
  3247. That is:
  3248. .sp
  3249. .RS 4
  3250. .ie n \{\
  3251. \h'-04' 1.\h'+01'\c
  3252. .\}
  3253. .el \{\
  3254. .sp -1
  3255. .IP " 1." 4.2
  3256. .\}
  3257. the number of added lines;
  3258. .RE
  3259. .sp
  3260. .RS 4
  3261. .ie n \{\
  3262. \h'-04' 2.\h'+01'\c
  3263. .\}
  3264. .el \{\
  3265. .sp -1
  3266. .IP " 2." 4.2
  3267. .\}
  3268. a tab;
  3269. .RE
  3270. .sp
  3271. .RS 4
  3272. .ie n \{\
  3273. \h'-04' 3.\h'+01'\c
  3274. .\}
  3275. .el \{\
  3276. .sp -1
  3277. .IP " 3." 4.2
  3278. .\}
  3279. the number of deleted lines;
  3280. .RE
  3281. .sp
  3282. .RS 4
  3283. .ie n \{\
  3284. \h'-04' 4.\h'+01'\c
  3285. .\}
  3286. .el \{\
  3287. .sp -1
  3288. .IP " 4." 4.2
  3289. .\}
  3290. a tab;
  3291. .RE
  3292. .sp
  3293. .RS 4
  3294. .ie n \{\
  3295. \h'-04' 5.\h'+01'\c
  3296. .\}
  3297. .el \{\
  3298. .sp -1
  3299. .IP " 5." 4.2
  3300. .\}
  3301. a NUL (only exists if renamed/copied);
  3302. .RE
  3303. .sp
  3304. .RS 4
  3305. .ie n \{\
  3306. \h'-04' 6.\h'+01'\c
  3307. .\}
  3308. .el \{\
  3309. .sp -1
  3310. .IP " 6." 4.2
  3311. .\}
  3312. pathname in preimage;
  3313. .RE
  3314. .sp
  3315. .RS 4
  3316. .ie n \{\
  3317. \h'-04' 7.\h'+01'\c
  3318. .\}
  3319. .el \{\
  3320. .sp -1
  3321. .IP " 7." 4.2
  3322. .\}
  3323. a NUL (only exists if renamed/copied);
  3324. .RE
  3325. .sp
  3326. .RS 4
  3327. .ie n \{\
  3328. \h'-04' 8.\h'+01'\c
  3329. .\}
  3330. .el \{\
  3331. .sp -1
  3332. .IP " 8." 4.2
  3333. .\}
  3334. pathname in postimage (only exists if renamed/copied);
  3335. .RE
  3336. .sp
  3337. .RS 4
  3338. .ie n \{\
  3339. \h'-04' 9.\h'+01'\c
  3340. .\}
  3341. .el \{\
  3342. .sp -1
  3343. .IP " 9." 4.2
  3344. .\}
  3345. a NUL\&.
  3346. .RE
  3347. .sp
  3348. The extra \fBNUL\fR before the preimage path in renamed case is to allow scripts that read the output to tell if the current record being read is a single\-path record or a rename/copy record without reading ahead\&. After reading added and deleted lines, reading up to \fBNUL\fR would yield the pathname, but if that is \fBNUL\fR, the record will show two paths\&.
  3349. .SH "GIT"
  3350. .sp
  3351. Part of the \fBgit\fR(1) suite