Skip to content

Kraymer/brack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo
BRACK: The Relentless Git Branch Name Acknowledger

License: MIT Donate

/bɹək/ :

  1. n. efficient tracking dog of the foxhound family. Friendly and not very intelligent.
  2. n. git pre-commit hook to enforce a branch naming policy across your project. Portmanteau word for Branch Acknowledger.

brack is a plugin for pre-commit that rejects commits when branch name does not validate a predefined format.

Installation

Copy pre_commit_hooks/brack to your .git/hooks/ folder and rename it as pre-commit.

Or if you use pre-commit framework, add this to your .pre-commit-config.yaml :

-   repo: https://github.com/kraymer/brack
    rev: main
    hooks:
    -   id: brack  

Configuration

By default branch name must match the regex "^(feature|bugfix|improvement|library|prerelease|release|hotfix)\/[a-z0-9._-]+$".

If you prefer to use a custom regex, edit your .pre-commit-config.yaml to give it as argument to the script :

    -   id: brack
        args: [-r, "<YOUR_REGEX>"]

Beware that regex must be compliant with POSIX Basic Regular Syntax.

Alternative

no_commit_to_branch is a hook provided with pre-commit that accomplishes the same thing but the logic is reversed : you define a regex that matches the branches you want NOT authorize commit to.
Depending on your usage, picking one or the other might facilitate maintenance of the regex.

About

The branch name acknowledger. Git pre-commit hook to enforce a branches naming policy.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages