Is there a way to list all commits that changed a specific file?
Find what file changed in a commit To find out which files changed in a given commit, use the git log --raw command.
Git file History provides information about the commit history associated with a file. To use it: Go to your project's Repository > Files. In the upper right corner, select History.
Select a file or directory in the Editing page, and choose Git Log in the Actions menu. This will show all commits in your current local branch that involve changes to the chosen file or directory.
On GitHub.com, you can access your project history by selecting the commit button from the code tab on your project. Locally, you can use git log . The git log command enables you to display a list of all of the commits on your current branch. By default, the git log command presents a lot of information all at once.
The --follow
works for a particular file
git log --follow -- filename
Difference to other solutions given
Note that other solutions include git log path
(without the --follow
). That approach is handy if you want to track e.g. changes in a directory, but stumbles when files were renamed (thus use --follow filename
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With