Home Explore Blog CI



git

3rd chunk of `Documentation/diff-options.adoc`
0e73a43a812593595e0224a22882604ec20cebf4e239cb780000000100000fa3
 patience algorithm to "support
	low-occurrence common elements".
--
+
For instance, if you configured the `diff.algorithm` variable to a
non-default value and want to use the default one, then you
have to use `--diff-algorithm=default` option.

`--stat[=<width>[,<name-width>[,<count>]]]`::
	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
	_<width>_. The width of the filename part can be limited by
	giving another width _<name-width>_ after a comma or by setting
	`diff.statNameWidth=<name-width>`. The width of the graph part can be
	limited by using `--stat-graph-width=<graph-width>` or by setting
	`diff.statGraphWidth=<graph-width>`. Using `--stat` or
	`--stat-graph-width` affects all commands generating a stat graph,
	while setting `diff.statNameWidth` or `diff.statGraphWidth`
	does not affect `git format-patch`.
	By giving a third parameter _<count>_, you can limit the output to
	the first _<count>_ lines, followed by `...` if there are more.
+
These parameters can also be set individually with `--stat-width=<width>`,
`--stat-name-width=<name-width>` and `--stat-count=<count>`.

`--compact-summary`::
	Output a condensed summary of extended header information such
	as file creations or deletions ("new" or "gone", optionally `+l`
	if it's a symlink) and mode changes (`+x` or `-x` for adding
	or removing executable bit respectively) in diffstat. The
	information is put between the filename part and the graph
	part. Implies `--stat`.

`--numstat`::
	Similar to `--stat`, 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 `-` instead of saying
	`0 0`.

`--shortstat`::
	Output only the last line of the `--stat` format containing total
	number of modified files, as well as number of added and deleted
	lines.

`-X [<param>,...]`::
`--dirstat[=<param>,...]`::
	Output the distribution of relative amount of changes for each
	sub-directory. The behavior of `--dirstat` can be customized by
	passing it a comma separated list of parameters.
	The defaults are controlled by the `diff.dirstat` configuration
	variable (see linkgit:git-config[1]).
	The following parameters are available:
+
--
`changes`;;
	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.
`lines`;;
	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 `--dirstat`
	behavior than the `changes` 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 `--*stat` options.
`files`;;
	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 `--dirstat` behavior, since it does
	not have to look at the file contents at all.
`cumulative`;;
	Count changes in a child directory for the parent directory as well.
	Note that when using `cumulative`, the sum of the percentages
	reported may exceed 100%. The default (non-cumulative) behavior can
	be specified with the `noncumulative` parameter.
_<limit>_;;
	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.
--
+
Example: The following will count changed files, while

Title: Git Diff Statistics and Directory Statistics
Summary
This section describes options for generating diff statistics and directory statistics in Git, including options for customizing the display of diffstat information, such as setting the width and count of lines, and options for analyzing the distribution of changes in subdirectories, including parameters for computing dirstat numbers and customizing the output.