Skip to main content
Git FAQ
Frequently asked questions around Git and Version Control.
Git FAQ featured image

How Do I Create a New Branch in Git?

Git makes creating and managing branches very easy. In fact, the power and flexibility of its branching model is one of the biggest advantages of Git!

You can create local branches on your machine to develop new features or work on bug fixes. Afterwards, you can publish them to any remote hosting service, such as GitHub or BitBucket, to allow your teammates to collaborate.

How Do I Create a New Branch and Start Working on It?

The fastest way to create a new branch and switch to it in one command is to use git switch -c:

$ git switch -c <new-branch>

This creates a new branch based on your current branch and switches to it immediately. If you're using a Git version older than 2.23, you can use the classic equivalent:

$ git checkout -b <new-branch>

Both commands do the same thing: they create a new branch and switch to it in a single step. The -c stands for "create" and -b stands for "branch."

Visual example:

Before:                          After:

main ● ─ ─ ─ ● ─ ● (HEAD)        main ● ─ ─ ─ ● ─ ●
                                                      \
                                          new-branch   ● (HEAD)

How Do I Create a New Branch Based on the current HEAD without Switching to It?

If you just want to create a branch without switching to it, use the git branch command with the branch name:

$ git branch <new-branch>

How Do I Create a New Branch Based on Some existing One?

If you want to base your new branch on a different existing branch and switch to it, use:

$ git switch -c <new-branch> <base-branch>

Or with the classic syntax:

$ git checkout -b <new-branch> <base-branch>

If you only want to create the branch without switching to it, use:

$ git branch <new-branch> <base-branch>

If you're using the Tower Git client, you can simply use drag and drop to create new branches (and to merge, cherry-pick, etc.):

You can learn more about Tower's drag and drop capabilities by clicking here.

How Do I Create a New Branch from a Specific commit?

If you want to start your new branch based on a specific commit (not a branch), then you can provide the commit hash as the starting point:

$ git branch <new-branch> f71ac24d

How Do I Create a New Branch from a Specific tag?

You can also base your new branch on a specific tag you already have in your repository:

$ git branch <new-branch> v1.2

How Do I Create a New Branch from a remote Branch?

To create a new local branch based on a remote branch, use:

$ git switch -c <new-branch> origin/<base-branch>

Or with the classic syntax, which automatically names the local branch after the remote:

$ git checkout --track origin/<base-branch>

To create the branch without switching to it, use git branch --track:

$ git branch --track <new-branch> origin/<base-branch>

How Do I Create a New Branch in a Remote Repository?

After working on your new local branch for some time, you might want to publish it in your remote repository, to share it with your team:

$ git push -u origin <local-branch>

The "-u" flag tells Git to establish a "tracking connection", which will make pushing and pulling much easier in the future.


How Do I Create a Feature Branch?

A feature branch is simply a regular branch you create to develop a specific feature in isolation. Create it from your main development branch:

$ git switch -c feature/user-authentication main

Or use the classic syntax:

$ git checkout -b feature/user-authentication main

Common naming conventions for feature branches:

  • feature/description — e.g., feature/login-page
  • feature/issue-number — e.g., feature/issue-42
  • bugfix/description — e.g., bugfix/header-alignment

Visual example:

main       ● ─ ● ─ ● ─ ─ ─ ─ ─ ● (merge)
                    \           /
feature/login        ● ─ ● ─ ●

For a deeper look at feature branch workflows and team collaboration patterns, check out Working with Feature Branches.

How Do I Create a Branch on GitHub?

  1. Go to your repository on GitHub
  2. Click the branch dropdown (shows your current branch)
  3. Type your new branch name
  4. Click "Create branch: from main" (or your current branch)

For more details on publishing a local branch to GitHub from the command line, see How to Create a Remote Branch.

What Does the "git branch" Command Do?

The git branch command is used for a variety of tasks:

  • Creating new local branches
  • Deleting existing local or remote branches
  • Listing local and/or remote branches
  • Listing branches that haven't been merged yet

List your local branches:

$ git branch

List remote branches:

$ git branch -r

List all branches (local and remote):

$ git branch -a


Learn More

About Us

As the makers of Tower, the best Git client for Mac and Windows, we help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Ebay get the most out of Git.

Just like with Tower, our mission with this platform is to help people become better professionals.

That's why we provide our guides, videos, and cheat sheets (about version control with Git and lots of other topics) for free.