Progress:
TIER 2 · MODULE 13· Intermediate

git annotate

POSIX-style output. Still works.

🎯 What & why

git annotate is the POSIX-flavoured sibling of git blame — same machinery, different output format kept around for tools that expected the classic annotate shape (CVS/SVN era).

🧠 Mental model

Think blame in a different shirt. Identical history walk, identical rename/copy detection, only the line prefix layout differs.

🛠️ Synopsis

git annotate [-b] [--root] [--show-stats] [-L <range>]
             [-l] [-t] [-S <revs-file>] [-M] [-C] [-C] [-C]
             [--since=<date>] [<rev>] [--] <file>

🎚️ Switches & options

FlagWhat it does
`-l`Show long (full 40-char) commit SHA, not the abbreviated form.
`-t`Show raw timestamp (epoch seconds + tz) instead of pretty date.
`-S <revs-file>`Use the given file as a list of revisions to walk — replaces history traversal with a curated set.
`-M`Detect moved/copied lines within the same file across renames.
`-C`Detect lines copied from other files in the same commit; repeat (-C -C) to widen the search.
`-L <start>,<end>`Annotate only the given line range — same syntax as blame.
`--show-stats`Print stats about the blame run (commits inspected, etc.).

💡 Use cases

🧪 Examples

Plain annotation
git annotate path/to/file.py
Long SHAs and raw timestamps
git annotate -l -t src/main.c
Restrict to lines 40-80
git annotate -L 40,80 README.md
Detect moves and cross-file copies
git annotate -M -C -C lib/util.go

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

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