Faster than 'log -- path' in a loop.
git last-modified reports, for each given path, the most recent commit that touched it. Much faster than scripting git log -1 -- <path> in a loop across many files.
Think of it as a batched 'who last touched this file' query. Relatively new command, so it may be missing from older Git installs.
git last-modified [<path>...]| Flag | What it does |
|---|---|
<path>... | Paths to query; defaults to all tracked files if omitted |
output | One line per path: <commit-sha> <path> |
fast path | Walks history once instead of once per file |
availability | Newer Git only; check 'git last-modified -h' first |
(no -- needed) | Paths are taken positionally |
git last-modifiedgit last-modified src/main.c src/util.c README.mdgit last-modified src/**/*.pygit last-modified | sortHit each option, then Check answers. Score is recorded; Next is always open.