Use Git CLI to find folder last changed date
I have a folder in git that contains all my projects. I wanted to find which projects I haven’t worked on in a while to clean them up, so I made this command.
ls -1 projects
dnd
home-server
learn-japanese
find projects -maxdepth 1 -type d \( ! -name . \) -exec git log --pretty=format:'%ad {}' --date=format:'%Y-%m-%d' -1 {} \; -exec echo \; | sort
2019-12-05 home-server
2023-01-07 learn-japanese
2023-04-08 dnd
Explanation
find projects -maxdepth 1 -type d \( ! -name . \) \
-exec git log --pretty=format:'%ad {}' --date=format:'%Y-%m-%d' -1 {} \; \
-exec echo \; \
| sort
%ad
is the date-1
looks at a single commit per folder