Skip to content

Instantly share code, notes, and snippets.

@paulbrodner
Created November 28, 2019 14:55
Show Gist options
  • Select an option

  • Save paulbrodner/20d787379567a8f3f8075223eaae6d69 to your computer and use it in GitHub Desktop.

Select an option

Save paulbrodner/20d787379567a8f3f8075223eaae6d69 to your computer and use it in GitHub Desktop.
ask-and-tag in git
#!/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