Progress:
TIER 3 · MODULE 30· Expert

git last-modified

Faster than 'log -- path' in a loop.

🎯 What & why

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.

🧠 Mental model

Think of it as a batched 'who last touched this file' query. Relatively new command, so it may be missing from older Git installs.

🛠️ Synopsis

git last-modified [<path>...]

🎚️ Switches & options

FlagWhat it does
<path>...Paths to query; defaults to all tracked files if omitted
outputOne line per path: <commit-sha> <path>
fast pathWalks history once instead of once per file
availabilityNewer Git only; check 'git last-modified -h' first
(no -- needed)Paths are taken positionally

💡 Use cases

🧪 Examples

All tracked files
git last-modified
Specific paths
git last-modified src/main.c src/util.c README.md
Whole subtree via shell glob
git last-modified src/**/*.py
Pipe to sort by SHA
git last-modified | sort

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.