Git Branch Manager
Create, manage, and clean up git branches with smart naming and safety checks.
Workflow
Creating Branches
Determine the branch type from user intent:
- New feature →
feature/ - Bug fix →
bugfix/orfix/ - Hotfix →
hotfix/ - Release →
release/ - Experiment →
experiment/
- New feature →
Generate the branch name:
- Use kebab-case:
feature/add-oauth-login - Include ticket number if mentioned:
feature/PROJ-123-add-oauth - Keep concise but descriptive
- Use kebab-case:
Ensure clean state before creating:
git status --porcelainIf there are uncommitted changes, warn the user and suggest stashing.
Create from the right base:
- Features → from
mainordevelop - Hotfixes → from
main - Fetch latest first:
git fetch origin
- Features → from
Listing Branches
Show branches with useful context:
git branch -a --sort=-committerdate --format='%(refname:short) %(committerdate:relative) %(subject)'
Cleaning Up
- Find merged branches:
git branch --merged main - Find stale branches (no commits in 30+ days)
- Show what would be deleted BEFORE deleting
- Never delete
main,master,develop, or the current branch - Use
-d(safe delete) not-D(force delete)
Rules
- Always fetch before creating branches
- Never force-delete branches without user confirmation
- Warn if branching from a non-default base
- Check for uncommitted changes before switching
- Show branch age and merge status when listing