search

Sunday, March 22, 2015

How to create git commit template

At work we integrated git with JIRA. If commit starts with our project name in JIRA and contains issue id, it will be automatically linked to that issue. For example:

PROJECT-10 Fix timezone

That pattern requires that every commit starts with the same characters "PROJECT-". Git supports commit templates, so every new commit message will include text from this template.

To make it work you just need to create a simple text file and configure git to use this file:
git config --local commit.template /path/to/git-commit-template.txt

No comments:

Post a Comment