Last active
April 25, 2016 17:04
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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