I use zsh per directory history [0] as well as this cron job I have set to run hourly:
#!/bin/bash
cd /Users/nmjohn/.directory_history \
&& git add . \
&& git commit -m "Automatic Backup: `date`" \
&& echo "Files Modified:" \
&& git log head -1 --name-only --pretty=format:"" | grep "[^\s]" | awk '{print "\t\t"$0}' \
&& echo ""
It's not bullet-proof, but since I never manually touch the directory it's worked without hiccup for the last ~6 months. When trying to remember the syntax to a rarely used function (or even the name itself) or coming up with a gnarly awk/sed/grep command, it's been incredibly helpful to have fairly granular search capability to go back and find them weeks later.Also ctrl+g in a terminal toggles between per directory history and global history which makes context switching easier when switching to a project not touched for a while.