A pre-commit hook to prepend a Jira issue to a commit message, extracted from the current branch name.
With this hook installed, when you commit, if a Jira issue is found in your branch name, and a Jira issue is not already included in your commit message, the Jira issue from the branch name will be prepended to your commit message.
-
Install
pre-commit
if it's not already installedGlobally with
pipx
:pipx install pre-commit
Or any of the ways mentioned in the pre-commit installation docs.
-
Add this hook to your
.pre-commit-config.yaml
file (create in root directory if it doesn't exist already).repos: - repo: https://github.com/falkben/pre-commit-prepend-jira-issue rev: v0.0.2 hooks: - id: prepend-jira-issue stages: [commit-msg]
-
Install this hook
pre-commit install --hook-type commit-msg
-
Commit the
.pre-commit-config.yaml
to your repo.
- https://github.com/radix-ai/auto-smart-commit
- https://agussarwono.com/article/add-ticket-to-your-commit/
- https://github.com/erskaggs/jira-pre-commit
Create virtual environment then install:
pip install -r dev-requirements.txt
pip install -e ".[dev]"
pip-compile --extra dev -o dev-requirements.txt pyproject.toml