Default commit message format is:
[Commit verb] [Issue Key]: [Issue Summary]
[Commit Message]
E.g. for the bug:
Fixed PRJNM-256: An email validation doesn't work
- Added missed email validator.
Where PNM-25 is an issue key of your tasks tracker.
There are available commit verbs:
Implemented
(for tasks)Fixed
(for bugs)Refactored
(for commits which contains refactoring only)CR Change(s)
("changes" or "change", for applying code review changes)
NOTE: Actually this can be extended. Please take a look some specific customization of commit message format.
About ignoring validation please read here.
Your valid commit message may looks like this:
I did it!
But due to using short verbs like I
or R
, etc., please use -
in the beginning. It will be considered as verb instead.
- I did it!
There are integrations with task trackers
- JIRA
- GitHub
Please take a look wizard example.
So, if you want to be lazy productive... :)
If you tired of copy-pasting issue key and summary that there is good news.
If you'd like to speed up of writing commit-verb that there is good news.
You may write it shortly with using JIRA project key:
F PRJNM-256 Added missed email validator.
The system will connect to JIRA and get an issue summary. Also it will recognize the commit-verb. There are following short-names:
I
forImplemented
F
forFixed
R
forRefactored
C
forCR Changes
And a project key can be omitted.
F 256
- Added missed email validator.
In this case the system will find a project key and set it (it should be set in this case).
You may omit verbs F
and I
. It will be identified by issue type.
256 Added missed email validator.
or verb R
for refactoring (C
- for CR Changes
)
R 256 Reformatted code
or for list
256 Added missed email validator.
- Reformatted code
In this case the system will take default verb by issue type. For bug - Fixed
and for tasks - Implemented
. Of course if you're making refactoring
or applying code review you have to set related verb.
Also, you may declare "active task" by similar command and don't care about numbers in commit messages:
$ commithook tracker:task 256
More info about command tracker:task
here.
The value can be checked w/o last argument. And a message will be simplest:
- Added missed email validator.
- Reformatted code
There is predefined configuration:
<?xml version="1.0"?>
<config>
<hooks>
<commit-msg>
<message>
<issue>
<type>
<tracker>
<jira>
<default>
<New_Type>task</New_Type>
</default>
</jira>
</tracker>
</type>
</issue>
</message>
</commit-msg>
</hooks>
</config>
You extend it with adding new nodes by adding new config node. E.g. we need to map New Type
to type task
.
$ commithook config --xpath hooks/commit-msg/message/issue/type/tracker/jira/default/New_Type task
Please always keep an eye on issue numbers. That's all just to be more lazy productive! ;D