Skip to content

fengzilong/git-hook-jira-id

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-hook-jira-id

Prefix jira id in every commit message using husky hook

terminal.gif

git cm in the gif is a shortcut for git commit -m customized by myself, no magic 😄

Installation

for NPM users:

npm i git-hook-jira-id -D

for YARN users:

yarn add git-hook-jira-id --dev

CLI Usage

Usage:
  $ git-hook-jira-id [options]

Options:
  -p, --prefix <prefix>  jira prefix
  -i, --interactive      interactive
  -h, --help             Display this message
  -v, --version          Display version number

prefix

It's used for matching jira id from your branch name

for example

git-hook-jira-id -p ABC

Internally it will use /ABC-\d+/i for searching jira id

interactive

If you want to prefix jira id case by case

interactive may be your best choice

User guide for husky users

  1. without --interactive, it will add jira id for every commit, it's simple but powerful
"husky": {
  "hooks": {
    "prepare-commit-msg": "git-hook-jira-id -p <PREFIX>"
  }
}
  1. with --interactive, you can make your own decision for every commit
"husky": {
  "hooks": {
    "prepare-commit-msg": "exec < /dev/tty && git-hook-jira-id -p <PREFIX> -i || true"
  }
}

Remember to replace <PREFIX> with your own prefix

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published