git whatchanged: Usage, Options & Common CI Errors
By Daniel Zoghalchali·Latchkey
git whatchanged lists each commit together with the files it changed.
whatchanged is an older, log-like command showing per-commit file changes. It still works, but git log --raw / --name-only is the documented, preferred way today.
What it does
git whatchanged walks history like git log but defaults to showing, for each commit, the list of files it modified (in raw diff format), making per-commit file churn easy to scan.
whatchanged is deprecated in favor of git log, so prefer git log --name-only / --raw for new scripts to avoid relying on legacy defaults. On a shallow clone it shows only the fetched commits, which can make file-history reports look truncated.
Using this in CI
CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.
.github/workflows/ci.yml
- uses:actions/checkout@v4with:fetch-depth:0 # history, tags, and git describe all need this- run:|git rev-parse --is-shallow-repository # expect falsegit rev-parse --abbrev-ref HEAD # prints HEAD when detached
Frequently asked questions
git whatchanged: Usage, Options & Common CI Errors?
whatchanged is an older, log-like command showing per-commit file changes. It still works, but git log --raw / --name-only is the documented, preferred way today.
What it does?
git whatchanged walks history like git log but defaults to showing, for each commit, the list of files it modified (in raw diff format), making per-commit file churn easy to scan.
Common errors in CI?
whatchanged is deprecated in favor of git log, so prefer git log --name-only / --raw for new scripts to avoid relying on legacy defaults. On a shallow clone it shows only the fetched commits, which can make file-history reports look truncated.