Skip to content

Instantly share code, notes, and snippets.

@aaronstaves
Last active December 23, 2022 11:46
Show Gist options
  • Save aaronstaves/df9d628aa4a5dfe4e851 to your computer and use it in GitHub Desktop.
Save aaronstaves/df9d628aa4a5dfe4e851 to your computer and use it in GitHub Desktop.
JIRA pre-commit message
#!/bin/bash
branch=`git rev-parse --abbrev-ref HEAD`
branchRegex='([A-Z_]+?)(-[0-9]+)'
if [[ $branch =~ $branchRegex ]]
then
sed -i "1s/^/\n\n${BASH_REMATCH[1]}${BASH_REMATCH[2]}/" $1
fi
# Put in BASE_DIR/.git/hooks/prepare-commit-msg. Make executable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment