Skip to content

Instantly share code, notes, and snippets.

@JasonCust
Last active April 25, 2016 17:04
Show Gist options
  • Save JasonCust/2dfc79762b0f74a82bf349cbf0303ac4 to your computer and use it in GitHub Desktop.
Save JasonCust/2dfc79762b0f74a82bf349cbf0303ac4 to your computer and use it in GitHub Desktop.
Git config file showcasing an advanced alias for lazily getting an author's commits for standup meetings.
[alias]
# Sample uses (defaults for Tues-Sat: from "yesterday AM" to "now", for Sun-Mon: from "last friday AM" to "now"):
# $ git standup
# $ git standup "last week"
# $ git standup "3 days ago"
# $ git standup "last monday" "last friday"
# $ git standup --stat
# $ git standup "last thursday AM" "last thursday PM" --pretty --date=short
# For date formats: https://github.com/git/git/blob/master/date.c
standup = "!f() { : git log ; \
if [ $# -gt 0 ] && [[ $1 != -* ]];\
then\
SINCE="${1}";\
shift;\
if [ $# -gt 0 ] && [[ $1 != -* ]];\
then\
UNTIL="${1}";\
shift;\
fi;\
else\
if [ $(date +%u) -lt 2 ];\
then\
SINCE="\"last friday AM\"";\
fi\
fi;\
SINCE="${SINCE:-yesterday AM}";\
UNTIL="${UNTIL:-now}";\
COMMITTER="$(git config user.name)";\
git log --since "\"${SINCE}\"" --until "\"${UNTIL}\"" --committer="\"${COMMITTER}\"" --all --abbrev-commit --no-merges --date=local --oneline "\"$@\"";\
}; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment