Skip to content

Instantly share code, notes, and snippets.

@abuduba
Last active December 19, 2019 21:30
Show Gist options
  • Save abuduba/d5b281fc8f4ed19375eecdc8f8390969 to your computer and use it in GitHub Desktop.
Save abuduba/d5b281fc8f4ed19375eecdc8f8390969 to your computer and use it in GitHub Desktop.
#!/bin/bash
FILE=$1
MESSAGE=$(cat $FILE)
TICKET=[$(git rev-parse --abbrev-ref HEAD | grep -Eo '^(\w+/)?(\w+[-_])?\d+' | grep -Eo '(\w+[-])?\d+' | tr "[:lower:]" "[:upper:]")]
if [[ $TICKET == "[]" || "$MESSAGE" == "$TICKET"* ]];then
exit 0;
fi
echo "$TICKET $MESSAGE" > $FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment