Ever edited a file and wondered when it got added to your repository? Or do you just want to know which commits changed a file. This command does the job for you.
git log --follow --oneline filename
Of course, filename is the full filepath along with the filename. Also, if you just need the commit hashes and not the commit message, use this command.
git log --pretty=format:'%h' --follow filename
That lists the short commit hash. To see the full commit hash, just change the formatting parameter from h, to H as shown below
git log --pretty=format:'%H' --follow filename