Article
home/blog/Loading

How to find a files latest changed time in git

You can find a files latest changed time using the following

git log -n 1 --follow --diff-filter=MR <file>

For Example

git log -n 1 --follow --diff-filter=MR README.md

How it works

  • -n 1 only show 1 result
  • --diff-filter=MR filters only Modified and Renamed commits
  • --follow follows the file through any renames it has had