Created
November 28, 2019 14:55
-
-
Save paulbrodner/20d787379567a8f3f8075223eaae6d69 to your computer and use it in GitHub Desktop.
ask-and-tag in git
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 -e | |
| TAG=$1 | |
| if [ -z "$TAG" ]; then | |
| echo "Tag argument is required." | |
| echo "Example:" | |
| echo " sh tag.sh 7.0.1-patch" | |
| exit 1 | |
| fi | |
| CURRENT_BRANCH=$(git branch | grep '*' | cut -d' ' -f 2) | |
| echo "Do you wish to tag and push the current branch '$CURRENT_BRANCH' as '$TAG' ?" | |
| select yn in "Yes" "No"; do | |
| case $yn in | |
| Yes) | |
| git tag "$TAG" -m "" | |
| git push origin "$TAG" | |
| break | |
| ;; | |
| No) | |
| exit | |
| ;; | |
| esac | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment