gg branch
Interactive branch manager with list, create, switch, and delete functionality.
Usage
bash
gg branch # Interactive branch manager
gg branch -c <name> # Create new branch
gg branch -d <name> # Delete branch
# Shorthand
gg bOptions
| Option | Description |
|---|---|
-c, --create <name> | Create a new branch |
-d, --delete <name> | Delete a branch |
-a, --all | Show all branches (local and remote) |
-r, --remote | Show only remote branches |
Interactive Branch Manager
Running gg branch without options opens an interactive menu:
bash
$ gg branch
šæ Branch Manager
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Current branch: feature/auth
Local branches:
ā feature/auth (current)
main 3 commits behind origin
feature/dashboard Last commit: 2 days ago
bugfix/login Last commit: 1 week ago
Actions:
[s] Switch branch
[c] Create new branch
[d] Delete branch
[m] Merge branch
[r] Rename branch
[q] Quit
Select action:Creating Branches
Quick Create
bash
# Create and switch to new branch
gg branch -c feature/new-feature
# Create from current branch
gg b -c bugfix/fix-issue-123Create with AI
bash
# Let AI suggest branch name based on task
gg ask "create branch for adding user authentication"
# Creates: feature/add-user-authenticationBranch Naming Conventions
GitGuru follows common conventions:
feature/- New featuresbugfix/orfix/- Bug fixeshotfix/- Urgent production fixesrelease/- Release preparation
Switching Branches
bash
# Interactive switch
gg branch
# Then press 's' and select branch
# Direct switch with AI
gg ask "switch to main branch"
# Or use git checkout/switch
git checkout mainSwitching with Uncommitted Changes
bash
$ gg ask "switch to main"
ā ļø You have uncommitted changes:
M src/auth.ts
A src/utils.ts
Options:
1. Stash changes and switch
2. Commit changes first
3. Cancel
What would you like to do?Deleting Branches
bash
# Delete local branch
gg branch -d feature/old-feature
# Delete with confirmation
$ gg branch -d feature/completed
Delete branch 'feature/completed'?
This branch has 5 unmerged commits.
Proceed? (y/N)Cleanup Merged Branches
bash
# Delete all merged branches
gg ask "delete all branches that have been merged into main"
# Prune remote tracking branches
gg ask "cleanup deleted remote branches"Branch Deletion
GitGuru will warn you if you try to delete a branch with unmerged commits. Force delete with
-D if you're sure you want to lose those commits.Listing Branches
bash
# List local branches
gg branch
# List all branches (local + remote)
gg branch -a
# List only remote branches
gg branch -rBranch Information
bash
# Get detailed info about a branch
gg ask "show info about feature/auth branch"
# Compare branches
gg ask "what commits are in feature/auth that aren't in main?"Examples
Feature Branch Workflow
bash
# Start new feature
gg branch -c feature/user-profile
# Work on feature...
gg add .
gg commit
# Keep up to date with main
gg ask "merge main into current branch"
# When done, merge back
gg ask "switch to main and merge feature/user-profile"Hotfix Workflow
bash
# Create hotfix from main
git checkout main
gg branch -c hotfix/critical-bug
# Fix and commit
gg commit -m "fix: resolve critical bug"
# Merge to main and deploy
gg ask "merge hotfix into main"Create Branch from Specific Commit
bash
# Use AI to create branch from specific point
gg ask "create branch bugfix/old-issue from commit abc1234"