liam.pm

Find commits that changed a file

Show all commits that modified a specific file:

git log --all -- [file path]

Limit to recent commits

Show only the last commit that changed the file:

git log --all -1 -- [file path]

Filter by change type

Show commits where the file was deleted:

git log --all --diff-filter=D -- [file path]

Common diff-filter options

Cleaner output

# One line per commit
git log --oneline --all -- [file path]

# Show file changes in each commit
git log --all --stat -- [file path]

Example

git log --oneline --all -- src/components/Header.js

Sources: