Last active
February 18, 2019 22:13
-
-
Save kevupton/363efddc92dc72d256f0f402ec04fdb3 to your computer and use it in GitHub Desktop.
Git Commiter with ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
{ | |
# BRANCH="feature/AGS-62-agtrader-digital-ad-changes-for-d" | |
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>&1) | |
} || { | |
echo "Is not a git repository..." | |
exit 1; | |
} | |
if [[ $BRANCH =~ ((^[a-zA-Z]+\/)|^)([A-Z]+-[0-9]+) ]]; then | |
ISSUE_ID=${BASH_REMATCH[3]} | |
else | |
echo "Branch '$BRANCH' has no code in it." | |
exit 1; | |
fi | |
MSG="${@:1}" | |
git commit -m "[$ISSUE_ID] $MSG"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment