Skip to content

Instantly share code, notes, and snippets.

@ConorSheehan1
Last active July 7, 2023 14:17
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ConorSheehan1/f6da062b536c633622e1aa438aa64593 to your computer and use it in GitHub Desktop.
Save ConorSheehan1/f6da062b536c633622e1aa438aa64593 to your computer and use it in GitHub Desktop.
bash script to show git commits for a standup.
# 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