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:
This will print the latest change date for one file. The
-1shows one log entry (the most recent), and--format=%cdshows the commit date. See the documentation forgit-logfor a full description of the options.You should be able to easily extend this for a group of files.