npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

branch-gen

v1.0.0

Published

BranchGen is a command-line tool designed to simplify the process of creating git branches with standardized naming conventions. This tool is highly configurable, ensuring it meets the diverse requirements of teams and workflows.

Readme

BranchGen

BranchGen is a command-line tool designed to simplify the process of creating git branches with standardized naming conventions. This tool is highly configurable, ensuring it meets the diverse requirements of teams and workflows.


Key Features

  • Customizable Branch Naming: Supports prefixes like feature, bugfix, hotfix for branch types.
  • Automated Versioning: Automatically appends version numbers to branch names to avoid conflicts (configurable).
  • Validation for Naming Standards: Ensures branch names and ticket IDs conform to specified patterns.
  • Retry Logic: Prompts users to retry if the branch already exists (if automated versioning is disabled).
  • Remote Branch Integration: Ensures compatibility with existing remote branches.

Installation

npm install -g branch-gen

Why Use BranchGen?

Manually creating branches often leads to inconsistent naming, which can confuse teams and complicate workflows. For example:

Problem Case:

  • Developers on your team create branches with inconsistent names like:
    • feature-add_login
    • bugfix/login_bug
    • hotfix/criticalFix

These variations cause confusion and make it difficult to search, manage, and enforce naming conventions across the repository.

How BranchGen Helps:

  • By using BranchGen, you can:
    • Standardize branch names (e.g., feature/PROJ-123-add-login).
    • Ensure ticket IDs follow a specific pattern (e.g., PROJ-123).
    • Automatically append version numbers to avoid branch conflicts.
    • Simplify workflows by reducing human error and maintaining consistency.

Configuration

BranchGen uses a configuration file named branchgen-config.json to customize its behavior. If the file is not found, default settings are applied.

Default Configuration

{
  "prefixes": ["feature", "bugfix", "hotfix"],
  "separator": "/",
  "maxBranchNameLength": 15,
  "ticketPattern": "^[A-Z]+-[0-9]+$",
  "defaultSourceBranch": "main",
  "branchNameSeparator": "-",
  "useAutomatedVersioning": true,
  "requireTicket": false,
  "requireBranchName": true
}

Options Explained

  • prefixes: List of branch types available for selection (e.g., feature, bugfix).
  • separator: Character used to separate the branch type from the rest of the branch name.
  • maxBranchNameLength: Maximum length allowed for a branch name.
  • ticketPattern: Regex pattern for validating ticket IDs (e.g., PROJ-123).
  • defaultSourceBranch: Default branch to check out before creating a new branch.
  • branchNameSeparator: Character used to replace spaces in branch names.
  • useAutomatedVersioning: Enables/disables automated numbering for duplicate branch names.
  • requireTicket: Enforces ticket ID input.
  • requireBranchName: Enforces branch name input.

Usage

npx branch-gen

Run the script and follow the prompts to generate a branch name and create the branch.

Example Workflow

  1. Select a branch type (e.g., feature).
  2. Enter a ticket ID if required (e.g., PROJ-123).
  3. Provide a branch name (e.g., add new feature).
  4. Choose a source branch from the list of remote branches.
  5. BranchGen checks out the source branch, pulls the latest changes, and creates the new branch.

Handling Duplicate Branch Names

  • If useAutomatedVersioning is enabled, BranchGen appends version numbers (e.g., feature/PROJ-123-add-new-feature-1).
  • If useAutomatedVersioning is disabled, you are prompted to retry with a different branch name.

Error Handling

  • No Remote Branches Found: If no remote branches exist, the script exits with an error.
  • Invalid Ticket ID: If the ticket ID does not match the specified pattern, the script prompts for a valid ID.
  • Branch Name Too Long: If the branch name exceeds the maximum allowed length, you are prompted to retry.

Contributing

Contributions are welcome! Feel free to submit issues or pull requests.


License

This project is licensed under the MIT License. See the LICENSE file for details.