50% off your 1st seat of GitKraken Pro — only $4/month!

How do you switch a Git branch?

When you’re working with the branches in your Git repository, it’s common for the need to arise to switch over to another branch. You might need to perform work on another branch, or assist on a code review for a teammate.

The switch action is also referred to as “checkout” in Git. In order to switch to another Git branch using the terminal, you’re going to use the git checkout command.

First, let’s go over how to use the checkout command to switch between local Git branches.

How do you switch between local Git branches?

Start by running the git branch command to view a list of your local branches so you know which branches you have to work with and which branch you currently have checked out.

Next, you will use the git checkout command to checkout, or switch to, a different local branch. It should look something like this:

$ git checkout <name-of-branch-you-want-to-switch-to>

How do you checkout a remote branch in Git?

Following a similar process, you’re going to checkout the remote branch in order to switch to the new branch.

See the process for how to checkout a remote branch in Git.

How do you switch a Git branch name?

Now, if you’re looking for how to switch the name of a Git branch, you will want to review our resources for How to Rename a Git Branch.

How do you switch a Git branch using GitKraken?

Let’s compare the experience of switching Git branches with the help of a Git client. One huge and obvious benefit provided by GitKraken is the ability to quickly and easily see your list of local and remote branches. No need to memorize names or take the time to pull up your Git branch list.

From either the left panel or the central graph in GitKraken, you can simply double-click or right-click on the name of the branch you wish to switch over to, and select Checkout from the context menu.

Additionally, you can open the GitKraken Fuzzy Finder using keyboard shortcut Cmd/Ctrl + P and typing “checkout” and then the name of the branch you wish to switch to.

Simplify the process for switching Git branches and optimize your workflow. Download the cross-platform GitKraken Git GUI for Windows, Mac, and Linux.

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.