Partilhar via


Create a Git branch in Visual Studio

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

    Screenshot of the New Branch option in the Git menu.

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

    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.

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>.

Next steps

To continue your journey, visit the Make a commit page. And to learn more about how to manage branches in Visual Studio, see Merge and rebase branches.