Files
git/Documentation/git-last-modified.adoc
Toon Claes 9dcc09bed1 last-modified: change default max-depth to 0
By default git-last-modified(1) doesn't recurse into subtrees. So when
the pathspec contained a path in a subtree, the command would only print
the commit information about the parent tree of the path, like:

    $ git last-modified -- path/file
    aaa0aab1bbb2bcc3ccc4ddd5dde6eee7eff8fff9	path

Change the default behavior to give commit information about the exact
path instead:

    $ git last-modified -- path/file
    aaa0aab1bbb2bcc3ccc4ddd5dde6eee7eff8fff9	path/file

To achieve this, the default max-depth is changed to 0 and recursive is
always enabled.

The handling of option '-r' is modified to disable a max-depth,
resulting in the behavior of this option to remain unchanged.

No existing tests were modified, because there didn't exist any tests
covering the example above. But more tests are added to cover this now.

Signed-off-by: Toon Claes <toon@iotcl.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-01-20 14:13:04 -08:00

82 lines
2.1 KiB
Plaintext

git-last-modified(1)
====================
NAME
----
git-last-modified - EXPERIMENTAL: Show when files were last modified
SYNOPSIS
--------
[synopsis]
git last-modified [--recursive] [--show-trees] [--max-depth=<depth>] [-z]
[<revision-range>] [[--] <pathspec>...]
DESCRIPTION
-----------
Shows which commit last modified each of the relevant files and subdirectories.
A commit renaming a path, or changing it's mode is also taken into account.
THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.
OPTIONS
-------
`-r`::
`--recursive`::
Recursively traverse into all subtrees. By default, the command only
shows tree entries matching the `<pathspec>`. With this option, it
descends into subtrees and displays all entries within them.
Equivalent to `--max-depth=-1`.
`-t`::
`--show-trees`::
Show tree entries even when recursing into them.
`--max-depth=<depth>`::
For each pathspec given on the command line, traverse at most `<depth>`
levels into subtrees. A negative value means no limit.
The default is 0, which shows all paths matching the pathspec
without descending into subtrees.
`-z`::
Terminate each line with a _NUL_ character rather than a newline.
`<revision-range>`::
Only traverse commits in the specified revision range. When no
`<revision-range>` is specified, it defaults to `HEAD` (i.e. the whole
history leading to the current commit). For a complete list of ways to
spell `<revision-range>`, see the 'Specifying Ranges' section of
linkgit:gitrevisions[7].
`[--] <pathspec>...`::
Show the commit that last modified each path matching _<pathspec>_.
If no _<pathspec>_ is given, all files and subdirectories are included.
See linkgit:gitglossary[7] for details on pathspec syntax.
OUTPUT
------
The output is in the format:
------------
<oid> TAB <path> LF
------------
If a path contains any special characters, the path is C-style quoted. To
avoid quoting, pass option `-z` to terminate each line with a NUL.
------------
<oid> TAB <path> NUL
------------
SEE ALSO
--------
linkgit:git-blame[1],
linkgit:git-log[1].
GIT
---
Part of the linkgit:git[1] suite