Skip to main content

Auto add ticket info to your git commits.

Project description

========
giticket
========


.. image:: https://img.shields.io/pypi/v/giticket.svg
:target: https://pypi.python.org/pypi/giticket

.. image:: https://travis-ci.com/milin/giticket.svg?branch=master
:target: https://travis-ci.org/milin/giticket

.. image:: https://readthedocs.org/projects/giticket/badge/?version=latest
:target: https://giticket.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status




Auto add ticket info to your git commits.


* Free software: MIT license
* Documentation: https://giticket.readthedocs.io.


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 it's ``[A-Z]+-\d+``.

Pass ``--format=`` or update ``args: [--format=<custom template string>]`` in your .yaml file if you have custom message replacement.
By default it's ``'{ticket} {commit_msg}``, where ``ticket`` is replaced with the found ticket number and ``commit_msg`` is replaced with the original commit message.


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: 'e0bf7ae'
hooks:
- id: giticket
args: ['--regex=PROJ-[0-9]', --format='"{ticket} {commit-msg}"'] # 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


.. _pre-commit: https://pre-commit.com/


=======
History
=======

0.1.5 (2019-04-23)
------------------

* Add custom commit message template to be passed in.


0.1.0 (2019-01-02)
------------------

* First release on PyPI.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

giticket-0.1.5.tar.gz (11.0 kB view hashes)

Uploaded Source

Built Distribution

giticket-0.1.5-py2.py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page