From: Toon Claes Date: Wed, 26 Nov 2025 06:09:45 +0000 (+0100) Subject: last-modified: document how depth is handled better X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd0f5724772c4449e1e169015a083fa2c31510a4;p=thirdparty%2Fgit.git last-modified: document how depth is handled better By default git-last-modified(1) only shows information about paths at the root level. This can be confusing. Clarify the command's behavior in the documentation. Signed-off-by: Toon Claes Signed-off-by: Junio C Hamano --- diff --git a/Documentation/git-last-modified.adoc b/Documentation/git-last-modified.adoc index 8409daebe9..36f72954a5 100644 --- a/Documentation/git-last-modified.adoc +++ b/Documentation/git-last-modified.adoc @@ -27,6 +27,7 @@ OPTIONS `--recursive`:: Instead of showing tree entries, step into subtrees and show all entries inside them recursively. + See the section "NOTES ABOUT DEPTH" below for more details. `-t`:: `--show-trees`:: @@ -38,6 +39,7 @@ OPTIONS levels of directories. A negative value means no limit. Setting a positive value implies `--recursive`. Cannot be combined with wildcards in the pathspec. + See the section "NOTES ABOUT DEPTH" below for more details. `-z`:: Terminate each line with a _NUL_ rather than a newline. @@ -70,6 +72,47 @@ avoid quoting, pass option `-z` to terminate each line with a NUL. TAB NUL ------------ +NOTES ABOUT DEPTH +----------------- + +By default this command only shows information about paths at the root level. +When a path that lives in a subtree is provided, information about the top-level +subtree is printed. For example: + +------------ +$ git last-modified -- sub/file + +abcd1234abcd1234abcd1234abcd1234abcd1234 sub +------------ + +To get details about the exact path in a subtree, add option `--recursive`: + +------------ +$ git last-modified --recursive -- sub/file + +5678abca5678abca5678abca5678abca5678abca sub/file +------------ + +This comes with a downside. When the path provided is a tree itself, with +option `--recursive` all paths in that subtree are printed too: + +------------ +$ git last-modified --recursive -- sub/subsub + +1234cdef1234cdef1234cdef1234cdef1234cdef sub/subsub/a +3456cdef3456cdef3456cdef3456cdef3456cdef sub/subsub/b +5678abcd5678abcd5678abcd5678abcd5678abcd sub/subsub/c +------------ + +To stop this command from traversing deeper into trees, add option +`--max-depth=0`: + +------------ +$ git last-modified --recursive --max-depth=0 -- sub/subsub + +3456def3456def3456def3456def3456def3456b sub/subsub +------------ + SEE ALSO -------- linkgit:git-blame[1],