I would like to have a script set up which prepends my commit message with a part of my branch name.
The part of my branch name I want is the project ticket number.
The format of the branch will be one of the following:
feature/ABC-123-my-cool-branch
ABC-123-my-cool-branch
In each case, the part I want to extract is ABC-123
.
Then I want to be able to assign the script to an alias like commit-with-ticket-number
so that I can type:
$ commit-with-ticket-number "My fantastic commit"
and the result of the commit message will be:
"ABC-123 My fantastic commit"
How can I write such a script that prepends text based on my branch name to my commit message?