This gist contains two different implementations of automatically appending the Jira ID to the git commit message.
I don't know if one way is better than the other. Choose one and create a file in your repo.
It must be named exactly: prepare-commit-msg
(no extension) and placed in the <repo-name>/.git/hooks
dir.
Very detailed discussion here: https://stackoverflow.com/questions/427207/can-git-hook-scripts-be-managed-along-with-the-repository
Make sure you save the file as UTF-8 (ASCII). Some editors (VSCode included) will guess at the encoding and save it as UTF-16. This makes the file not runnable.