aboutsummaryrefslogtreecommitdiff
path: root/Documentation/diff-options.adoc
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/diff-options.adoc')
-rw-r--r--Documentation/diff-options.adoc28
1 files changed, 28 insertions, 0 deletions
diff --git a/Documentation/diff-options.adoc b/Documentation/diff-options.adoc
index 640eb6e7db..18a9020389 100644
--- a/Documentation/diff-options.adoc
+++ b/Documentation/diff-options.adoc
@@ -887,5 +887,33 @@ endif::git-format-patch[]
reverted with `--ita-visible-in-index`. Both options are
experimental and could be removed in future.
+--max-depth=<depth>::
+ For each pathspec given on command line, descend at most `<depth>`
+ levels of directories. A value of `-1` means no limit.
+ Cannot be combined with wildcards in the pathspec.
+ Given a tree containing `foo/bar/baz`, the following list shows the
+ matches generated by each set of options:
++
+--
+ - `--max-depth=0 -- foo`: `foo`
+
+ - `--max-depth=1 -- foo`: `foo/bar`
+
+ - `--max-depth=1 -- foo/bar`: `foo/bar/baz`
+
+ - `--max-depth=1 -- foo foo/bar`: `foo/bar/baz`
+
+ - `--max-depth=2 -- foo`: `foo/bar/baz`
+--
++
+If no pathspec is given, the depth is measured as if all
+top-level entries were specified. Note that this is different
+than measuring from the root, in that `--max-depth=0` would
+still return `foo`. This allows you to still limit depth while
+asking for a subset of the top-level entries.
++
+Note that this option is only supported for diffs between tree objects,
+not against the index or working tree.
+
For more detailed explanation on these common options, see also
linkgit:gitdiffcore[7].