What's the simplest one-liner to get the last commit date for a bunch of files in a Git repository (i.e., for each file, the date of the last commit that changed that file)?
The context for this is that I'm using other Bash commands to find a long list of files matching some criteria, and I'd like to just pipe this list into a Git command to get the last commit date for each file.
The following command will be helpful:
git log -1 --format=%cd filename.txt
This will print the latest change date for one file. The
-1 shows one log entry (the most recent), and
--format=%cd shows the commit date. See the documentation for
git-log for a full description of the options.
You should be able to easily extend this for a group of files.