Created
July 25, 2016 06:45
-
-
Save akx/1c99d5d16f7a072b1c505ba63b28e0a2 to your computer and use it in GitHub Desktop.
git-lastmod.sh: print the last commit dates of currently existing files in the current repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# print the last commit dates of currently existing files in the current repository | |
( | |
git ls-files | sed 's/^/+ /' | |
git log --format=format:"~ %aI" --name-only . | |
) | gawk ' | |
/^~/ {date=$2;} | |
/^+/ {extant[$2] = 1;} | |
/^[^~+]/ {dates[$1] = date;} | |
END { for (file in dates) if(extant[file]) print(dates[file], file); } | |
' | sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment