1 minute read

Checking a file’s change history in git is simple. Put the path of the file you want to check in file_path.

git log -p -- file_path

If you want to see the change history word by word, just add the –word-diff option.

git log -p --word-diff -- file_path

This is enough on its own, but sometimes I want the convenience of checking it through a GUI. However, SourceTree, the tool I mainly use on Windows, doesn’t seem to have this feature. On Linux, SourceTree won’t run anyway, so you can use git cola. git cola supports checking the change history per file. So, after reviewing the tools listed here,

I decided to use TortoiseGit.

I chose it because it’s a trusty turtle I’ve been using since the TortoiseCVS days. It looks a bit old-fashioned, but it’s clean and works well. Here’s how to check. This is based on the Korean version.

  1. In Windows Explorer, right-click the file whose log you want to check
  2. Hover over TortoiseGit
  3. Click Show log

In conclusion,

Squirtle, I choose you!


Appendix

SourceTree also has a feature similar to git log -p – file_path. In the Korean version, it’s the Log Selected feature that appears when you right-click a file name. But unless you’re checking the log of a recently modified file, it’s a bit cumbersome.

If you really can’t be bothered to install all sorts of things, you can just use the feature built into your IDE. If you’re a Visual Studio Code user, you can install and use the Git history or GitLens extension.

Leave a comment