git log --follow -p -- path-to-file
This will show the entire history of the file, including history beyond renames and with diffs for each change. In other words, if the file named bar
was once named foo
, then git log -p bar
(without the --follow
option) will only show the file’s history up to the point where it was renamed.
Options:
--follow
ensures that you see file renames-p
or--patch
ensures that you see how the file gets changed--
option tells Git that it has reached the end of the options and that anything that follows--
should be treated as an argument.
For a graphical view, use gitk
:
gitk [filename]
To follow the file across file renames:
gitk --follow [filename]
See https://stackoverflow.com/questions/278192/view-the-change-history-of-a-file-using-git-versioning