git log --follow <path>
Display a file's full commit history including renames.
This command shows the complete commit history of a file even after it has been renamed, which is essential for tracking how a file evolves over time.
It works by leveraging the --follow
flag to go back through commit history across renames, ensuring that no commits are missed due to changes in the file's path; you can combine it with flags like -p
to view patch-level changes or --stat
for a summary of modifications.
Similar commands include using git log <path>
without --follow
for a history limited to the current file name, while additional variants like -n <number>
restrict the number of entries or combining it with git blame
provide further insights into code changes.
Related commands: