A composable CLI to generate and create standardized Git branch names using a pattern + transform pipeline.
npx new-branchOr install globally:
npm install -g new-branchBootstrap a .newbranchrc.json config interactively:
npx new-branch initOr accept all defaults in one shot:
npx new-branch init --yesThen generate branch names:
npx new-branch \
--type feat \
--title "Add login page" \
--id PROJ-123 \
--create✅ Branch created and switched to: feat/add-login-page-PROJ-123
You can also pass a pattern inline:
{
"pattern": "{type}/{title:slugify}-{id}",
"types": [
{ "value": "feat", "label": "Feature" },
{ "value": "fix", "label": "Bug Fix" }
]
}- Pattern language — declarative syntax with variables, transforms, and arguments
- 16 built-in transforms —
slugify,kebab,camel,max,replace,stripAccents, and more - Interactive init wizard —
new-branch initbootstraps your config with live preview - Flexible config —
.newbranchrc.json,package.json, orgit config - Pattern aliases — define named patterns and switch with
--use feature - Interactive mode — prompts for missing values, disable with
--no-prompt - Git safety — sanitized and validated via
git check-ref-format - Didactic modes —
--explain,--list-transforms,--print-config
| Section | Description |
|---|---|
| Getting Started | Installation and first branch |
| Init Wizard | Bootstrap config interactively |
| Patterns | Pattern language syntax and examples |
| Transforms | All 16 transforms with I/O tables |
| Configuration | Config sources and precedence |
| Pattern Aliases | Named patterns with --use |
| CLI Reference | All flags and options |
| Recipes | GitHub Flow, Gitflow, Monorepo |
pnpm install
pnpm test:run
pnpm buildMIT
