git-branch-pattern-check

1.0.4 • Public • Published

git-branch-pattern-check

Simple script to validate git branch name before pushing it to repository. Helpful if you want to enforce naming convention in your team without manually checking branch names

Installation

npm i -D git-branch-pattern-check

Usage

Best way to use library is to run it as git hook. You could use Husky for it (or any library of your choice).

{
  "husky": {
      "hooks": {
        "pre-push": "git-branch-pattern-check '^(feature|fix|hotfix|release)\/.+'"
      }
    }
  "devDependencies": {
    "husky": "^2.1.0"
  }
}

Basic patterns:

^(feature|fix|hotfix|release)\/.+' - branch has to start with feature/, fix/, release/ or hotfix/

(feature|release|hotfix)\/(JIRA-\d+) - it should look like feature/JIRA-1234

(feature|release|hotfix)\/(JIRA-\d+\/)?[a-z-]+ - it should look like feature/branch-name or include JIRA's code like feature/JIRA-1234/branch-name

include master and develop: ^master|develop|(feature|fix|hotfix|release)\/.+'

Issues

If you've encountered sth spooky and want to share please fill Bug Report here: https://github.com/burnpiro/git-branch-patter-check/issues

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.4
    40
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.4
    40
  • 1.0.3
    0
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i git-branch-pattern-check

Weekly Downloads

40

Version

1.0.4

License

MIT

Unpacked Size

3.33 kB

Total Files

6

Last publish

Collaborators

  • burnpiro