git whatchanged -p filename
is also equivalent to git log -p filename
in this case.
You can also see when a specific line of code inside a file was changed with git blame filename
. This will print out a short commit id, the author, timestamp, and complete line of code for every line in the file.
This is very useful after you've found a bug and you want to know when it was introduced (or who's fault it was).