Query git reflog for all commits to a specific file
Try:
git rev-list --all -- foo.txt
This will give you a list of all commits containing foo.txt.
I'd use:
git rev-list --all --remotes --pretty=oneline foo.txt
The --remotes option lets you use also your remotes, the --pretty=oneline makes it display also the commit message. Very useful when you're looking for a modification pushed to remote in a branch you don't know the name of.
Came across this while searching for an answer, which is simple: git reflog -- $PATH
, which will include amends and other actions that will not be visible otherwise (though beware, reflog will be pruned by gc)