Skip to content

Instantly share code, notes, and snippets.

@corpix
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corpix/d9855390b38972b38a71 to your computer and use it in GitHub Desktop.
Save corpix/d9855390b38972b38a71 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Helpers for current branch tagging
function get_filetered_branch_repr {echo `git rev-parse --abbrev-ref HEAD` | sed 's/\//-/g'};
function get_last_tag {git tag | grep `get_filetered_branch_repr` | sort -r | head -n 1};
function get_incremented_tag {
get_last_tag | \
python -c "for line in __import__('sys').stdin: l=line.split('-');v=l[-1].rstrip().split('.');v[-1]=str(int(v[-1])+1);print '-'.join(l[:-1]+['.'.join(v)])"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment