branchname-validator v1.1.0
Branch Name Validator
A validator tool designed to validate the Git branch naming conventions in your projects.
With Branch Name Validator, you can easily enforce Git branch naming conventions. It ensures branches follow the required format (e.g., feature/branch-name, bugfix/issue-123) and prevents invalid names before creation. Ideal for teams maintaining consistent workflows! π
Table of Contents
This package enforces branch naming conventions using Git hooks (pre-push
). It ensures that only correctly named branches can be created or pushed, maintaining a clean and structured Git workflow.
β¨ Features
β
Prevents pushing invalid branch names
β
Blocks invalid branch creation
β
Supports pre-push
hook
β
Easy installation and automatic setup
π¦ Install
# Usage with NPM
npm install branch-name-validator
Flow
Once this package is installed, the script which is needed to validate the branch name automatically gets saved inside the .git/hooks
folder with the file name pre-push
. If this file is already present then the contents present in the script is appended to that file.
Supported Branch Naming Patterns
This extension enforces the following sample branch name formats:
Type | Example |
---|---|
Feature | feature/login-ui |
Bug Fix | bugfix/issue-123 |
Hotfix | hotfix/critical-crash |
Release | release/v1.2.0 |
Experiment | experiment/new-model |
Branch Validator VS Code Extension
Download Branch Validator
Overview
Branch Validator is a VS Code extension that automatically validates Git branch names to ensure they follow a specific naming convention. The validation runs whenever you switch branches and before pushing changes.
Features
- β Automatic branch name validation when switching branches in VS Code
- β Prevents pushing from an invalid branch
- β
Supports the following branch naming patterns:
feature/login-ui
bugfix/issue-123
hotfix/critical-crash
release/v1.2.0
experiment/new-model
- β Works seamlessly with VS Codeβs built-in Git UI
Installation
- Open VS Code.
- Go to Extensions (
Ctrl+Shift+X
). - Search for
Branch Name Validator
(or install manually by loading the extension). - Click Install.
- Restart VS Code if needed.
Usage
- Open a Git repository in VS Code.
- Switch branches using the Git Bash.
- If the branch name is valid, a success message will appear.
- If the branch name is invalid, an error message will be displayed.
- The extension will also prevent pushing changes from an invalid branch.
How It Works
- Real-time Validation: The extension listens for branch changes and validates them.
- Push Interception: If the branch name is invalid, the push command is blocked.
- Error Notifications: If an invalid branch name is detected, a notification appears in VS Code.
Made with β€οΈ for better branch management!