Menu
Coddy logo textTech

Creating A Branch

Part of the Version Control section of Coddy's Terminal journey — lesson 29 of 58.

To start a new branch, use git branch followed by the name you want:

git branch feature-login

This creates a new branch pointing at the current commit. It does not switch to it. You stay on the branch you were on, but a new pointer now exists at the same place.

Listing branches confirms the new one was created:

git branch
  feature-login
* main

Branch names are conventionally lowercase and use hyphens between words. Common patterns include feature-x, fix-bug-123, and experiment-y.

challenge icon

Challenge

Beginner

The repo already has one commit on main. Create a new branch called feature-search. Then list all branches.

The expected output shows both branches in alphabetical order, with main still marked as current.

Try it yourself

Terminal
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Version Control