This pre-commit hook transforms your Git commit messages into Jira smart commits.
If your branch name contains a Jira issue key such as ABC-123
, the hook will automatically format your commit message into a Jira smart commit:
Command | Log entry |
---|---|
git commit -m "release the kraken." | ABC-123 Release the kraken ABC-123 #time 0w 0d 2h 8m Release the kraken Effect: Logs the time since your last commit on any branch in the Work Log tab. |
git commit -m "Release the kraken A kraken lives in dark depths, usually a sunken rift or a cavern filled with detritus, treasure, and wrecked ships." |
ABC-123 Release the kraken ABC-123 #comment A kraken lives in dark depths, usually a sunken rift or a cavern filled with detritus, treasure, and wrecked ships. ABC-123 #time 0w 0d 2h 8m Release the kraken Effect: Posts a comment to the Jira issue and logs the time since your last commit in the Work Log tab. |
If the branch name does not contain a Jira issue key, the commit message is not modified. The time logged takes into account non-working hours such as lunch breaks and nights.
See How to Write a Git Commit Message for an explanation of the seven rules of a great Git commit message:
- Separate subject from body with a blank line
- Limit the subject line to 50 characters
- Capitalize the subject line (automated)
- Do not end the subject line with a period (automated)
- Use the imperative mood in the subject line
- Wrap the body at 72 characters
- Use the body to explain what and why vs. how
Add the following to your .pre-commit-config.yaml
file:
repos:
- repo: https://github.com/radix-ai/auto-smart-commit
rev: v1.0.3
hooks:
- id: auto-smart-commit
and make sure to run pre-commit install --hook-type prepare-commit-msg
to install the hook type necessary for this hook.