We are using Redmine for tracking our programming tasks in my current project. Like most other ticketing systems, it has the ability to link commits in your source code repositories to a ticket when the commit message refers the ticket number.Changes foo to bar because of baz. refs #1234
I became tired of adding the ticket number manually to each commit message. Fortunately, git can add the number by itself with the help of a little hook and a naming convention for your feature branches.
Your feature branch name should include the ticket number like so:
Now create the file
.git/hooks/commit-msg in your local repository with the following
This extracts the ticket number from the branch name. The ticket number is then appended to your commit message on each commit when git executes the hook.