branch-name-check
v1.0.0
Published
A CLI tool that validates Git branch naming conventions for teams and CI/CD workflows.
Maintainers
Readme
branch-name-check
A CLI tool that validates Git branch naming conventions for teams and CI/CD workflows.
Installation
npm install -g branch-name-checkOr run instantly:
npx branch-name-check feature/JIRA-102-login-pageCLI Usage
$ npx branch-name-check feature/JIRA-102-login-page
🔍 Checking branch: feature/JIRA-102-login-page
✅ Valid branch name$ npx branch-name-check test
🔍 Checking branch: test
❌ Invalid branch name
Rule: ^(feature|bugfix|hotfix)\/[A-Z]+-[0-9]+-.+$
💡 Suggested: feature/JIRA-102-testValid Examples
feature/JIRA-102-login-page
bugfix/JIRA-220-auth-fix
hotfix/JIRA-888-payment-fixInvalid Examples
test
abc
fix-final
mainGit Hook Installation
npx branch-name-check installCreates pre-push and pre-commit hooks to validate branch names automatically.
CI Mode
npx branch-name-check --ciExits with code 1 if the current branch name is invalid. Works with GitHub Actions, GitLab CI, and Jenkins.
Custom Config
Create branch-name-check.config.json in your project root:
{
"pattern": "^(feature|bugfix|hotfix|release)\\/[A-Z]+-[0-9]+-.+$"
}API
import { validate } from "branch-name-check";
const result = validate("feature/JIRA-102-login");
// { valid: true, branch: "feature/JIRA-102-login", pattern: "...", suggestion: null }Test
node test.jsLicense
MIT
