Branch

A branch is a separate line of work in a git repository, started from an existing commit. On a branch you can make changes without touching the project's main version, usually called main. When the work is finished and checked, the branch is merged back into the main version, typically through a pull request.

A separate version of the project in git, where you work on something new without breaking the main version. It’s not a copy in another folder: in one folder you’re on a single branch at a time. When you’re happy, you merge the branch into the main version.

You’ll also find it as: branches

How it shows up in Claude Code

You can ask Claude to create a new branch before a bigger change, so the main version stays untouched until you've checked the result. The documentation even gives the example “create a new branch called feature/quickstart”. Claude can also resolve the conflicts that appear when merging, when the same spot in a file was changed on two branches.

Branches are also the foundation of worktrees: the documentation explains that each worktree is a separate checkout of the project on its own branch, so two Claude sessions can work side by side without colliding. Watch out for one mix-up: the /branch command in Claude Code branches the conversation, it doesn't create a git branch.

Example

Before asking for a new page, you type:

create a new branch called menu-page and work on it

You make the changes, check them, commit. At the end you ask Claude to open a pull request from menu-page into main.

Common mistakes

  • Working directly on main on something risky. If it goes wrong, the main version is already broken.
  • Forgetting which branch you're on. Run git status or ask Claude “which branch am I on?”.
  • Keeping a branch open for weeks. The longer it stays separate, the more conflicts appear when you merge.
  • Thinking /branch in Claude Code makes a git branch. It only copies the conversation.

Related terms and where you learn it

A branch fills up with commits and is merged through a pull request. For several branches open at once, in separate folders, there's the worktree. All of it happens in git.

You see it in the lesson “8. How do you use Claude with git?”, in module 04 · The working method, step by step.

Source: Claude Code documentation: Common workflows

How it appears in the course

"statusLine" is a line of information shown at the bottom of the screen: for example which git branch you’re on, which model you’re using, how much you’ve used.

What other useful settings are there? · Module 03, Permissions: what Claude may do

↪ What’s a branch and a PR?

What does a SKILL.md file look like? · Module 05, Skills: reusable recipes

git branch --show-current prints the name of the branch you’re on.

How do you show Claude fresh information, from the moment it starts? · Module 05, Skills: reusable recipes

Learn Claude Code from zero, in plain English

12 modules with 1–2 minute lessons, which you can also do on your phone. The first two modules are free.