git version 18.104.22.168 (Apple Git-48)
I’m using the –name-status option in all of these examples because I want to. It provides that status of the file(s) in each commit. Without –name-status, we get only the commits, not the specific file information.
Find a single file with its path. Path is relative to current directory. This can be a little odd if the file has been deleted from the current branch you’re on, since the file won’t be in your working tree, but git still wants the relative path. Maybe it just seems odd to me *shrug*.
git log --follow --name-status -- some/file/path/fileYouWant.ext
Find a single file, but we don’t know the path. We can glob it!
git log --follow --name-status -- **/fileYouWant.ext
Find all files ending in some extension. Let’s say I want to find all js files in my repo.
git log --follow --name-status -- **/*.js
If nothing else, this will likely help future me!