Skip to content

Instantly share code, notes, and snippets.

@Benjamin-Dobell
Last active June 29, 2017 12:33
Show Gist options
  • Save Benjamin-Dobell/bb7ae216036c7e5641b3731fafa2598c to your computer and use it in GitHub Desktop.
Save Benjamin-Dobell/bb7ae216036c7e5641b3731fafa2598c to your computer and use it in GitHub Desktop.
End of financial year logs
LOG_DIR=~/EOFY/2016-2017/
mkdir -p $LOG_DIR
for dir in */ ; do
cd $dir
if git log &> /dev/null; then
project=$(basename $dir)
for branch in $(git for-each-ref --format='%(refname:strip=2)' refs/heads/); do
LOG=$(git log $(git merge-base master $branch)..$branch --since="2016-07-01T00:00:00+10:00")
if [ -n "$LOG" ]; then
echo $LOG > $LOG_DIR/$project.$branch.log
fi
done
LOG=$(git log master --since "2016-00-01T00:00:00+10:00")
if [ -n "$LOG" ]; then
echo $LOG > $LOG_DIR/$project.master.log
fi
fi
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment