git log --all -- <filepath>

List complete commit history involving a specific file.

This command outputs the entire commit history that impacts the provided file, across all branches.

By using the --all flag, the command pulls in logs from every branch in your repository, rather than just the currently checked-out branch. This is particularly useful for tracing changes to specific files throughout the entire history of a project.

To view logs from only the current branch, the --all can be omitted.

Additionally, for a summarized version of each commit, including only the commit hash and message, the --oneline flag can be used: git log --all --oneline -- <filepath>.