📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Git & GitHub Branching

Branching

5 min read Quiz at the end
Create, switch, rename, delete, and push branches — the core of all Git collaboration workflows.

Branching

git branch                  # list local branches
git branch -a               # list all (including remote)
git branch feature/login    # create branch
git switch feature/login    # switch to branch
git switch -c feature/login # create and switch (modern)
git checkout -b feature/login  # older syntax

# Rename
git branch -m old-name new-name

# Delete
git branch -d feature/login   # safe (merged only)
git branch -D feature/login   # force delete

# Push branch to remote
git push origin feature/login
git push -u origin feature/login  # set upstream
Topic Quiz · 1 questions

Test your understanding before moving on

1. Which command creates and immediately switches to a new branch?
💡 git switch -c feature (or git checkout -b feature) creates and switches in one command.