file-history-header
A small, dependency-free command-line tool and Node library that keeps an auto-generated FILE HISTORY comment block at the top of every source file in your project, sourced straight from git log.
Real git history,
right in the file.
On every commit, it rewrites a small comment block at the top of each changed file to reflect that file's real commit history - including the very commit you just made.
Because the block is generated from git log --follow (so it survives renames/moves), it can never drift from what actually happened - there's nothing to forget to update, unlike a hand-written "last modified by..." comment.
Re-running it is idempotent: if nothing changed, the file is left byte-for-byte untouched.
* File: src/login-form.ts
* Full history: git log --follow -- src/login-form.ts
* ------------------------------------------------------------------------
* 2026-09-24 Priya Shah feat: extract shared API transport into a package
* 2026-09-14 Priya Shah feat: bilingual notice-rights explainer pages
* 2026-08-30 Jordan Lee chore: add file-history headers
* END FILE HISTORY */
Zero Configuration Setup
Installing wires itself up automatically, with no manual config-file editing required. It installs a post-commit git hook to your project (either in .husky/ or .git/hooks/). No other tool is required.
Zero Runtime Dependencies
It is pure Node.js (node:fs, node:child_process, node:path), shipped with zero npm dependencies of its own. It only needs Git on PATH and Node.js >= 18.
The generated hook never relies on PATH either, bypassing common PATH resolution issues with GUI git clients.
Why use this package?
Supported Out Of The Box
Recognizes languages globally: JS/TS, Java, C/C++/C#, Go, Rust, Swift, Kotlin, Scala, PHP, CSS/SCSS/LESS, Python, Ruby, shell, YAML, TOML, HTML, XML, SQL, and Lua.
Includes The Current Commit
Runs as a post-commit hook right after the commit is created, automatically regenerating the header and folding it into the same commit with git commit --amend --no-edit.
Configurable
Optional file-history-header.config.json to control max entries, restrict extensions, exclude directories, or add custom comment styles per extension.
Won't Call The Network
Every operation is a local git read/write. There's no analytics, no telemetry, no update-check ping, nothing.
Won't Rewrite Past History
It only ever amends the commit that was just made, inside the same post-commit hook invocation that fired for it - never an older commit or a rebase.
Package Manager Agnostic
Zero package-manager-specific code - it behaves identically installed via npm, pnpm, or yarn.
