Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 2.4 KB

File metadata and controls

49 lines (33 loc) · 2.4 KB
title Create a branch to track code changes
description Create a branch for source code control in Visual Studio with Git based off an existing branch for your project or solution.
ms.date 3/8/2026
ms.topic how-to
author ghogen
ms.author ghogen
ms.subservice general-ide

Create a Git branch in Visual Studio

It's easy to create a new branch in Visual Studio; all you have to do is base it off an existing branch.

Here's how.

  1. To start, make sure you've got a previously created or cloned repo open.

  2. From the Git menu, select New Branch.

    :::moniker range="visualstudio" :::image type="content" source="media/visualstudio/git-menu-new-branch.png" alt-text="Screenshot of the New Branch option in the Git menu."::: :::moniker-end :::moniker range="vs-2022" :::image type="content" source="media/vs-2022/git-menu-new-branch.png" alt-text="Screenshot of the New Branch option in the Git menu."::: :::moniker-end

  3. In the Create a new branch dialog box, enter a branch name.

    [!TIP] For branch naming details, see Special characters in branch and tag names.

    :::image type="content" source="media/vs-2022/git-create-new-branch-dialog.png" alt-text="Screenshot of the Create a New Branch dialog box.":::

  4. In the Based on section, use the drop-down list to choose whether you want to base your new branch off an existing local branch or a remote branch.

  5. The Checkout branch checkbox, which is on by default, automatically switches to the newly created branch. Toggle this option if you want to remain in the current branch.

  6. The Track remote branch checkbox, which only appears if you select Remote in the Based on section, is selected by default if the remote has a matching branch name. If the branch is intended to be a local version of the remote branch, this should be selected; otherwise, clear the checkbox. See Remote branches.

There you have it; you've created a new branch.

Tip

The equivalent command for this action is git checkout -b <new-branch> <existing-branch>.

Related content