Last active
July 7, 2023 14:17
-
-
Save ConorSheehan1/f6da062b536c633622e1aa438aa64593 to your computer and use it in GitHub Desktop.
bash script to show git commits for a standup.
This file contains 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
# show commits from all branches for current git user. | |
function my-commits-since() { | |
git log --all --author=$(git config user.email) --since=$@ | |
} | |
# show commits from yesterday. | |
# if none were found, assume it's Monday and show commits from Friday. | |
function standup() { | |
if [ -z "$(my-commits-since yesterday)" ]; then | |
my-commits-since last.friday.midnight $@; | |
else | |
my-commits-since yesterday $@; | |
fi | |
} | |
standup $@ | |
# # inspired by https://gist.github.com/tinifni/3756796 | |
# # and https://stackoverflow.com/questions/24555358/git-log-only-show-yesterdays-commit | |
# # git aliases (add to ~/.gitconfig under the [alias] section and run using `git standup`) | |
# # dstandup checks date using http://www.gnu.org/software/coreutils/date rather than assuming it's monday if no commits are found from yesterday | |
# mcs = "!f() { git log --all --author=$(git config user.email) --since=$1; }; f" | |
# standup = "!if [ -z $(git mcs yesterday.midnight) ]; then git mcs last.friday.midnight; else git mcs yesterday.midnight; fi;" | |
# dstandup = "!if [ $(date +%u) -eq 1 ]; then git mcs last.friday.midnight; else git mcs yesterday.midnight; fi;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment