Skip to content

Instantly share code, notes, and snippets.

@slyphon
Created December 17, 2010 22:26
Show Gist options
  • Save slyphon/745824 to your computer and use it in GitHub Desktop.
Save slyphon/745824 to your computer and use it in GitHub Desktop.
just a shortcut for creating a tag object and (optionally) pushing it
#!/bin/bash
if [[ $# -lt 1 ]]; then
echo "Usage $(basename $0) [-p] tagname" >&2
echo 'the -p option will run `git push --tags` after creating the new tag' >&2
exit 1
fi
DO_PUSH=''
while getopts ':p' option
do
case $option in
p) DO_PUSH='yes' ;;
esac
done
shift $(($OPTIND - 1))
git tag -am "$1" $1
if [[ $DO_PUSH == 'yes' ]]; then
git push --tags
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment