Skip to content

Instantly share code, notes, and snippets.

@cmccandless
Created February 14, 2019 15:18
Show Gist options
  • Save cmccandless/705ad9e5b2a32b313dc3222083f2a27c to your computer and use it in GitHub Desktop.
Save cmccandless/705ad9e5b2a32b313dc3222083f2a27c to your computer and use it in GitHub Desktop.
Script for listing commit subjects over time period specified
#!/bin/bash
if [[ "$@" == *'--help'* ]]; then
echo "usage: what-i-did [since] [until] [format]"
echo ' See `man git-log` for more information'
echo " Examples:"
echo " what-i-did commits from self since 6am today"
echo " what-i-did yesterday commits from self over last 24hrs"
echo " what-i-did '6am yesterday' '6pm yesterday'"
echo " commits from self between 6am-6pm"
echo " yesterday"
exit 1
fi
since="${1:-6am}"
until="${2:-now}"
fmt="${3:-%s}"
author="$(git config --get user.name)"
git log --all --since="$since" --until="$until" --author="$author" --pretty=format:"$fmt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment