Join us December 10-11, 2024
| Developer Experience + AI Conference
Register now free →
Search
Close this search box.

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.

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