Skip to content

Instantly share code, notes, and snippets.

@pricco
Last active August 1, 2022 02:20
Show Gist options
  • Save pricco/8281372 to your computer and use it in GitHub Desktop.
Save pricco/8281372 to your computer and use it in GitHub Desktop.
List commits of all subdirectories for the specified date: ./history.sh 2013-12-28
exec 2> /dev/null
original=`pwd`
function history {
d=$1
author=$2
for i in $(find . -type d -print -maxdepth 3); do
cd "${i}"
if [ -d ".git" ]; then
h=`git rev-list --after "${d}T00:00:00" --before "${d}T23:59:59" --tags --branches --remotes --author=${author} --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' | sed '/^commit/ d'`
l=$?
if [ $l = 0 ]; then
if [[ $h =~ [^[:space:]] ]]; then
echo "======= > $i"
git log --pretty=format: --name-only --since="${d} 00:00:00" --until="${d} 23:59:59" | sort | uniq | grep "\S"
# echo "$h"
fi
fi
fi
cd $original
done
}
# example:
# ./history.sh 2016-01-27 pricco
history $1 $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment