Created
July 6, 2016 03:38
-
-
Save victortrac/d24cd4713fd240fb36783425b4b9c673 to your computer and use it in GitHub Desktop.
git tag a release with commit messages
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
#!/bin/bash | |
# Check out production branch and bring it up to date. | |
git fetch origin | |
git checkout production | |
git reset --hard origin/production | |
# Create a name for the new tag. | |
NEW_TAG=$(date +"%Y%m%d-%H%M") | |
# Grab the last tag. | |
LAST_TAG=$(git tag | xargs -I@ git log --format=format:"%ai @%n" -1 @ | sort | awk '{print $4}' | tail -n1) | |
# Tag the release and push it to github. | |
git tag -a ${NEW_TAG} -m "$(git log --pretty=oneline --no-merges ${LAST_TAG}..${NEW_TAG})" | |
git push origin ${NEW_TAG} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment