Utility to autoadd ticket number specified in your branch name to your commits!
Clone or download
Latest commit 8e674d3 Jan 18, 2019

README.rst

giticket

https://travis-ci.com/milin/giticket.svg?branch=master Documentation Status

Auto add ticket info to your git commits.

Features

This hook saves developers time by prepending ticket numbers to commit-msgs. For this to work the following two conditions must be met:

  • The ticket format regex specified must match, if the regex is passed in.
  • The branch name format must be <ticket number>_<rest of the branch name>

For e.g. if you name your branch JIRA-1234_awesome_feature and commit Fix some bug, the commit will be updated to JIRA-1234 Fix some bug.

Pass --regex= or update args: [--regex=<custom regex>] in your .yaml file if you have custom ticket regex. By default its [A-Z]+-\d+.

It is best used along with pre-commit. You can use it along with pre-commit by adding the following hook in your .pre-commit-config.yaml file.

repos:
- repo:  https://github.com/milin/giticket
  rev: '8814c81'
  hooks:
  - id:  giticket
    args: ['--regex=PROJ-[0-9]']  # Optional

You need to have precommit setup to use this hook.

Install Pre-commit and the commit-msg hook-type.

pip install pre-commit==1.11.1
pre-commit install
pre-commit install --hook-type commit-msg