Branch Management in Git

From the Git cheat sheet · Branching · verified Jul 2026

Branch Management

Create, list, and delete branches for parallel development

bash
# List branches
git branch            # Local
git branch -r         # Remote
git branch -a         # All

# Create and switch (modern, Git 2.23+)
git switch -c <name>
git switch <branch>

# Older equivalents
git checkout -b <name>
git checkout <branch>

# Delete branch
git branch -d <branch>  # Safe (merged only)
git branch -D <branch>  # Force delete
💡 git switch is the modern verb for branches (Git 2.23+)
⚠️ -D force-deletes unmerged branches
✅ Delete branches after merging
⚡ Use descriptive prefixes (feature/, fix/, chore/)

More Git tasks

Back to the full Git cheat sheet