I'm trying to add a pre-commit hook in TurtoiseGit to automatically add the JIRA number in my commit message. The JIRA number is always the first part of my branch name.
For example: JIRA-456-fix-cleanup-crash
, I would like to have JIRA-456
The git command I'm using is git rev-parse --abbrev-ref HEAD > %2
. But unfortunately this give me the whole branch name. I only need JIRA-456
.
I tried using the shell command findstr
to substring the branch name without success.
The mechanism I use is the one listed here: https://gitlab.com/tortoisegit/tortoisegit/issues/2229#note_1781864
git
at all, but more like "How do I getJIRA-456
fromJIRA-456-fix-cleanup-crash
in a batch file?"