Skip to content

Instantly share code, notes, and snippets.

@djui
Forked from andreineculau/jira2branch.sh
Created August 29, 2012 20:52
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 djui/3518791 to your computer and use it in GitHub Desktop.
Save djui/3518791 to your computer and use it in GitHub Desktop.
JIRA ticket to branch name
#!/bin/sh
case $(uname) in
"Linux") S=$(xclip -o);;
"Darwin") S=$(pbpaste -prefer txt);;
esac
python -c "
import sys,re;
F = sys.argv[2].split('\n');
F.insert(1, sys.argv[3]);
print re.sub(r'''[^a-z0-9]''', '-', ' '.join(F).lower())[:50]" - "$S" $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment