Skip to content

Instantly share code, notes, and snippets.

@DonBattery
Last active October 26, 2021 00:38
Show Gist options
  • Save DonBattery/e2353b8c1e102225a23e4c02820ec49a to your computer and use it in GitHub Desktop.
Save DonBattery/e2353b8c1e102225a23e4c02820ec49a to your computer and use it in GitHub Desktop.
gitmm
[alias]
# git jm "commit message"
# will add the Jira ticket ID (e.g.: PROJ-123) to your commit message
jm = "!f() { [[ $(git branch --show-current) =~ [A-Z]{2,}-[0-9]+ ]]; git commit -m \"${BASH_REMATCH[0]} ${1}\"; }; f"
function gitmm() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
git commit -m "${BRANCH} ${1}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment