Skip to content

Instantly share code, notes, and snippets.

@sunny
Created October 27, 2010 17:10
Show Gist options
  • Save sunny/649479 to your computer and use it in GitHub Desktop.
Save sunny/649479 to your computer and use it in GitHub Desktop.
git-my-commits-since
#!/bin/bash
# Returns a pretty list of your commits in the subfolders
#
# I use to know what I've worked on in the last week, eg:
#
# $ cd ~/code/
# $ git-my-commits-since '7 days ago'
# project-foo
# 3a16032 2 days ago New cool feature
# a07ba63 3 days ago Added improbability drive
# rails
# d2d1d55 2 hours ago Now scaling
# If you need more recursion to find git files use the `find`
gits=`ls -d */.git */*/.git`
# gits=`find . -name .git | grep -v __`
you=`git config user.email`
for git in $gits; do
commits=`GIT_DIR=$git git --no-pager log -i --author="$you" --pretty=format:'%h %cr %s' --since="$1"`
if [ "$commits" ]; then
echo $git | sed 's%/.git$%%'
GIT_DIR=$git git --no-pager log -i --author="$you" --pretty=format:'%Cgreen%h %cr %s%Creset' --since="$1"
echo
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment