Skip to content

Instantly share code, notes, and snippets.

@knaeckeKami
Created June 26, 2023 19:39
Show Gist options
  • Save knaeckeKami/a935c00cae494a92fbae5323c7cff40a to your computer and use it in GitHub Desktop.
Save knaeckeKami/a935c00cae494a92fbae5323c7cff40a to your computer and use it in GitHub Desktop.
check_if_commits.sh
BRANCH=refs/remotes/origin/main
LAST_REV=$(git rev-parse --verify $BRANCH)
LAST_TAG=$(git describe --tag --abbrev=0 $LAST_REV)
COMMIT_COUNT=$(git rev-list --count $BRANCH $LAST_TAG..)
if [ $COMMIT_COUNT = 0 ]; then
echo "Nothing to build! No commits since $LAST_TAG on $BRANCH."
exit 0;
else
# do stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment