How to retrieve the last modification date of all files in a Git repository

git

I know how to retrieve the last modification date of a single file in a Git repository:

git log -1 --format="%ad" -- path/to/file

Is there a simple and efficient way to do the same for all the files currently present in the repository?

Best Answer

A simple answer would be to iterate through each file and display its modification time, i.e.:

git ls-tree -r --name-only HEAD | while read filename; do
  echo "$(git log -1 --format="%ad" -- $filename) $filename"
done

This will yield output like so:

Fri Dec 23 19:01:01 2011 +0000 Config
Fri Dec 23 19:01:01 2011 +0000 Makefile

Obviously, you can control this since its just a bash script at this point--so feel free to customize to your heart's content!