Skip to content

Instantly share code, notes, and snippets.

@lucasassisrosa
Created January 28, 2022 23:30
Show Gist options
  • Save lucasassisrosa/029925aa6173b69a7e7b7ab940356585 to your computer and use it in GitHub Desktop.
Save lucasassisrosa/029925aa6173b69a7e7b7ab940356585 to your computer and use it in GitHub Desktop.
View new commits since last deploy commit in monorepo packages
#!/bin/bash
# Print pretty list of commits since last deploy.
#
#
# Usage example:
#
# ./bin/commits_since_deploy.sh analytics-app c9bad41
#
# This will give you something like:
#
# 2022-04-26 [Bob] chore(deps-dev): bump uglify-js from 3.5.3 to 3.5.8 (#122)
# 2022-04-26 [Charles] feat(JIRA-XXXX) feature commit message
# Update tags locally, since only local tags can be sorted
git fetch
package_name=$1
tag=$2
grep_args=''
# -x Select only those matches that exactly match the whole line
# -E Interpret patterns as extended regular expressions
grep_args='-x -E'
# Check if tag exists
if [ "$tag" == "" ]; then
echo "\
No matching deploy tag found for that package.\
Make sure the package name is correct.\
For example: 'analytics-app'\
" && exit; else
echo "Viewed commits since '$tag'";
fi
git log \
--pretty="%C(yellow)%ad%C(reset) %C(blue)[%an]%C(reset) %s" \
--date=short $tag.. "packages/$package_name"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment