Git Product home page Git Product logo

prefix-commit-message's Introduction

Prefix Commit Message

This script is meant to be used with Husky as a prepare-commit-msg Git hook. Each time you commit, it extracts the issue identifier or user-story identifier from the current branch name and prefixes your commit message with the extracted identifier.

It supports identifiers of the form ABCD-1234 and 1234, and will look for such identifiers right after the / in the name of the current branch. If you're on the branch feature/JIRA-874-cannot-login-on-macos, for example, this hook will prefix each of your commit messages with [ JIRA-874 ].

There are simpler shell scripts that achieve the same, but this solution works on Windows too.

Installation

First, install Husky:

npm install husky --save-dev

Then, install this hook:

npm install prefix-commit-message --save-dev

Finally, add the following to package.json:

"husky": {
    "hooks": {
      "prepare-commit-msg": "prefix-commit-message"
    }
  }

Custom prefix

Pass JS snippet (which will be evaluated during the runtime) in single quotes as configuration param to override default prefix structure:

For example:

"prepare-commit-msg": "prefix-commit-message '${identifier} '"

Will produce commit message: JIRA-874 cannot-login-on-macos

prefix-commit-message's People

Contributors

ljpengelen avatar

Watchers

 avatar

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.