# git whatchanged: Usage, Options & Common CI Errors

> git whatchanged lists commits with the files each one touched. Reference for --oneline, -p, path limiting, and why git log is the recommended replacement.

Source: https://latchkey.dev/learn/command-reference/git-whatchanged  
Updated: 2026-06-25

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.

## Common usage

```Terminal
git whatchanged --oneline
git whatchanged -p -- path/to/file
git whatchanged --since="1 week ago"
# modern equivalent:
git log --raw --oneline
```

## Options

| Flag | What it does |
| --- | --- |
| --oneline | Compact commit headers |
| -p | Show the full patch too |
| -- <path> | Limit to changes under a path |
| --since / --until | Filter by date |

## 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.

## 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@v4
  with:
    fetch-depth: 0   # history, tags, and git describe all need this

- run: |
    git rev-parse --is-shallow-repository   # expect false
    git rev-parse --abbrev-ref HEAD          # prints HEAD when detached
```

> `git rev-parse --abbrev-ref HEAD` returns the literal string `HEAD` on a detached checkout rather than a branch name. On GitHub Actions read `github.ref_name` instead; the git command cannot know what it was checked out for.

## FAQ

### 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.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
