Skip to content

Instantly share code, notes, and snippets.

@kevupton
Last active February 18, 2019 22:13
Show Gist options
  • Save kevupton/363efddc92dc72d256f0f402ec04fdb3 to your computer and use it in GitHub Desktop.
Save kevupton/363efddc92dc72d256f0f402ec04fdb3 to your computer and use it in GitHub Desktop.
Git Commiter with ID
#!/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