Skip to main content

Branches for Git and GitHubs

Branches are lightweight, movable pointers to commits that let you work on a feature or fix in isolation. You create one with git switch -c, combine work with git merge, or replay commits onto a new base with git rebase. Branching is the core of parallel work in Git.

Stage: Branching · Part of the Git and GitHub roadmap · Last reviewed 19 November 2026

What to learn in Branches

Branches interview questions

What is a fast-forward merge?

A fast-forward merge happens when the target branch has no new commits since the feature branch split off. Git just moves the branch pointer forward to the feature's latest commit, so no merge commit is created and history stays linear.

Why is it unsafe to rebase a shared branch?

Rebase rewrites commits, giving them new hashes. If others already based work on the old commits, their histories diverge from yours and force pushes can overwrite their work. Rebase only local or personal branches.

Where Branches fits in the Git and GitHub roadmap

Branches belongs to the Branching stage (beginner level), which takes about 9 hours. Work in parallel.

Back to the full Git and GitHub roadmap