• 0

List the commits that changed a file

Lets say you deleted a file in your branch and you later realize that you need it back. If you remember the file path + filename, you can easily check which was the last commit that involved this file by the command
git log -1 -- [file path]
Now that you know which commit sha deleted the file, you can easily do a git checkout from there and get it back. If you omit the -1 option, it will list you all the commits in which that particular file was modified in reverse chronologial order.