At work we have some git repos that were converted from CVS originally created back in 2002 or so. A lot of the things in these repos is cruft and could be deleted. I wrote a little git command to report the most recent commit date for each thing in the current directory.


  1. ack -naf|xargs -I {} sh -c ‘echo -n $(git log -1 –format=%ai “{}”); echo ” {}”‘

  2. Nice one anonymous! I golfed it down and replaced ack with find:

    find . -maxdepth 1 -type f |xargs -I {} git log -1 –format=”%ai {}” “{}”

  3. Those one-liners don’t solve the original problem. The entries should be sorted by date and directories should not be skipped.

    ls -p | xargs -I {} git log -1 –format=”%ai {}” “{}” | sort -r

    This one sorts by date and marks directories with a slash (like the original). Note that the original script would have mis-sorted dates earlier than 9th Sep 2001 because of string sort on unix time, but the earliest expected date was after that anyway.

Comments are closed.