DevIhor / auto-smart-commit

Automatically format Git commits into Jira smart commits

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auto Jira smart commit

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:

  1. Separate subject from body with a blank line
  2. Limit the subject line to 50 characters
  3. Capitalize the subject line (automated)
  4. Do not end the subject line with a period (automated)
  5. Use the imperative mood in the subject line
  6. Wrap the body at 72 characters
  7. Use the body to explain what and why vs. how

Installation

Add the following to your .pre-commit-config.yaml file:

repos:
  - repo: https://github.com/radix-ai/auto-smart-commit
    rev: v1.0.2
    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.

About

Automatically format Git commits into Jira smart commits

License:MIT License


Languages

Language:Python 100.0%