Use git ls-files
to find git files, and then git log
to format the output. But since git log
will group several file together when they share same commit time, I prefer to have it process one file at a time and then sort the result.
The resulted one-liner:
for f in $(git ls-files); do git --no-pager log --color -1 --date=short --pretty=format:'%C(cyan)%ai%Creset' -- $f ; echo " $f"; done |sort -r
If you want to add it to your .bashrc:
function gls() {
for f in $(git ls-files); do git --no-pager log --color -1 --date=short --pretty=format:'%C(cyan)%ai%Creset' -- $f ; echo " $f"; done |sort -r
}
Then running gls
will output something like:
2019-09-30 11:42:40 -0400 a.c
2019-08-20 11:59:56 -0400 b.conf
2019-08-19 16:18:00 -0400 c.c
2019-08-19 16:17:51 -0400 d.pc
The result is in time descending order.