Sign In

git log --follow <path>

Display a file's full commit history including renames.

This command helps you trace the complete history of a specific file, even if it has been renamed or moved, so you can understand how and why it changed over time. It operates by walking through the commit history and tracking the file across renames to show all relevant commits.

The --follow flag tells this command to continue tracking the history of the file across renames, instead of stopping when the file’s current name no longer appears in older commits. The <path> parameter specifies the file you want to inspect, relative to the repository root (for example, src/index.js or docs/readme.md).

Related variations and complements include: git log <path> to see history for a file without following renames, git log -p <path> to show the actual line-by-line changes for that file, and git log --stat <path> to see summarized change statistics for each commit.

Examples

  • git log --follow src/components/Button.jsx
  • git log --follow docs/api/user-endpoints.md
  • git log --follow package.json
Manual page
git log
Related commands

Sign in to Git Examples