This question is closely related to List all commits for a specific file however it is different. I want to find out which commits, across all branches, had modified a given file.
To make it more complex, the given file may or may not be in the working tree.