Search
Close this search box.

How do you create a branch in Git?

Before going over how to create a Git branch using the CLI, we will review the much simpler process using the visual context provided by the cross-platform GitKraken Git GUI.

Spend less time on common workflow tasks, like creating new branches, so you can reserve your mental energy for the hard stuff.

How do you create a branch in GitKraken?

To create a new Git branch in GitKraken, you will simply right-click on any branch or commit and select Create branch here.

ProTip: GitKraken will automatically checkout the branch for you immediately after the branch has been created, so you can get straight to work on the right file.

Alternatively, you can use Cmd/Ctrl + P to launch the GitKraken Fuzzy Finder and type “create branch”. This will jump you straight into the create branch field for whichever reference you currently have checked out.

Managing branches can get cumbersome in the terminal. Let GitKraken do the organizing so you can focus on the code.

How do you create a Git branch in the command line?

If you’re using the terminal, you will use the git branch command followed by your desired branch name to create a Git branch in your repository.

It should look something like this:

git branch feature-A

This will create a Git branch on your currently checked-out reference.

How do you view your Git branch list?

If you’re not using GitKraken, you won’t have the benefit of seeing all of your repository’s branches in your main UI. If you’re using the CLI, you can run the git branch command to view a list of your local branches and confirm that your newly created branch appears.

Git branch in the CLI

How do you checkout a new Git branch?

After you have created a Git branch, you can use the Git checkout command followed by the branch name to checkout that branch.

git checkout feature-A

How do you create and checkout a Git branch at the same time?

Once you’re comfortable with how to create a Git branch, you will likely enjoy the ability to create a new branch and checkout the branch using one command.

You can combine the two actions of creating and checking out a branch in Git with:

git checkout -b <branch name>

This will create a new branch and immediately checkout the branch.

Additional Resources

Table of Contents

Make Git Easier, Safer &
More Powerful

with GitKraken

Visual Studio Code is required to install GitLens.

Don’t have Visual Studio Code? Get it now.

Team Collaboration Services

Secure cloud-backed services that span across all products in the DevEx platform to keep your workflows connected across projects, repos, and team members
Launchpad – All your PRs, issues, & tasks in one spot to kick off a focused, unblocked day. Code Suggest – Real code suggestions anywhere in your project, as simple as in Google Docs. Cloud Patches – Speed up PR reviews by enabling early collaboration on work-in-progress. Workspaces – Group & sync repos to simplify multi-repo actions, & get new devs coding faster. DORA Insights – Data-driven code insights to track & improve development velocity. Security & Admin – Easily set up SSO, manage access, & streamline IdP integrations.
winget install gitkraken.cli