Skip to content

Instantly share code, notes, and snippets.

@timuruski
Last active August 29, 2015 14:08
Show Gist options
  • Save timuruski/0335b7d1c2d9f8def059 to your computer and use it in GitHub Desktop.
Save timuruski/0335b7d1c2d9f8def059 to your computer and use it in GitHub Desktop.
Git SRED helper.
# In your .gitconfig add this alias:
# [alias]
# sred = "!source ~/.git_sred_log && sred_log"
# Assumes input date is formatted as YYYY-MM-DD,
# passes additional arguments to git-log.
sred_log() {
sred_date="${1:-$(date +"%Y-%m-%d")}"
shift
until_date=$(date -v "+1d" -jf "%Y-%m-%d" "${sred_date}")
since_date=$(date -v "-6d" -jf "%Y-%m-%d" "${sred_date}")
author=$(git config --get user.email)
git log --reverse --author "${author}" --since "${since_date}" --until "${until_date}" ${@}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment