Created
October 11, 2019 10:47
-
-
Save Yengas/25ed42199b5657b9d4d9339b3acb8e15 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# git commit with branch helper | |
gam () { | |
MESSAGE="$1" | |
TASK_ID=$(git branch | grep \* | cut -d ' ' -f2 | perl -l -ne '/[a-z]+\/([A-Z]+\-[0-9]+)($|=)/ && print $1') | |
if [ -z "$TASK_ID" ]; then | |
echo "task id not be found. branch examples: feature/RECO-01, feature/RECO-01=long-description" | |
echo "falling back to normal commit" | |
git commit -am "$MESSAGE" | |
elif [ -z "$MESSAGE" ]; then | |
echo "message could not be found. add a message to your commit." | |
else | |
git commit -am "$TASK_ID $MESSAGE" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment