Giter VIP home page Giter VIP logo

giticket's Introduction

giticket

image

image

image

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. - Unless you use regex_match mode, 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.

Pass --mode= or update args: [--mode=regex_match] in your .yaml file to extract ticket by the regex rather than relying on branch name convention. With this mode you can also make use of {tickets} placeholder in format argument value to put multiple comma-separated tickets in the commit message in case your branch contains more than one ticket.

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: v1.3
  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
pre-commit install
pre-commit install --hook-type commit-msg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.