How to Switch and Check Out Branches in Git (Checkout & Switch)
Run git switch <branch-name> to switch branches - or the older git checkout <branch-name>, which does the same thing but also handles other operations switch doesn't. Either one makes that branch your new HEAD.
Below: creating a branch as you switch to it, checking out a remote branch that doesn't exist locally yet, and how Tower turns "switch branch" into a double-click in the sidebar.
The Git Cheat Sheet
No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!
Switching to a Local Branch
The most common operation: make an existing branch your current working branch.
# Modern (Git 2.23+)
$ git switch other-branch
# Classic
$ git checkout other-branch
To quickly jump back to the previously checked-out branch, use - as the branch name:
$ git switch -
$ git checkout -
Creating and Switching to a New Branch
Both commands can create a new branch and switch to it in a single step:
# Modern
$ git switch -c new-branch
# Classic
$ git checkout -b new-branch
You can also base the new branch on a specific starting point — another branch, a tag, or a commit:
$ git switch -c hotfix v2.1.0
$ git switch -c bugfix main
$ git switch -c experiment abc1234
No Command Line Needed
Switching Branches in Tower
In case you are using the Tower Git client, switching branches becomes easy as pie. Simply double-click a branch in the sidebar to make it the new HEAD branch — or choose a branch from a list.
Checking Out a Remote Branch
You cannot switch to a remote branch directly — Git requires a corresponding local branch that tracks the remote one. First, make sure your local repository knows about the remote branch:
$ git fetch origin
Then create a local tracking branch from the remote:
# Modern: Git detects the remote branch automatically and sets up tracking
$ git switch newsletter
# Classic: explicit syntax
$ git checkout --track origin/newsletter
Either way, Git creates a local branch named newsletter that tracks origin/newsletter. From then on, git pull and git push work without any extra arguments.
Use git branch -r to list all remote-tracking branches and find the exact name to use:
$ git branch -r
origin/main
origin/newsletter
origin/feature-xyz
No Command Line Needed
Checking Out Remote Branches in Tower
In case you are using the Tower Git client, tracking a remote branch is as easy as drag and drop:
git switch vs. git checkout
Both commands can switch and create branches, but they differ in scope:
| git switch | git checkout | |
|---|---|---|
| Switch branches | Yes | Yes |
| Create branches | -c flag |
-b flag |
| Restore files | No (use git restore) |
Yes |
| Detach HEAD | -d flag |
Yes (any commit) |
| Discard local changes | --discard-changes |
-f flag |
| Available since | Git 2.23 | Always |
The key advantage of git switch is clarity: it only handles branch operations, reducing the risk of accidentally overwriting files when you meant to switch branches.
# These two are equivalent:
$ git checkout -b new-feature
$ git switch -c new-feature
# These two are equivalent:
$ git checkout -f other-branch
$ git switch --discard-changes other-branchDownload the Cheat SheetFree
Get 18 of our most popular Cheat Sheets in one handy ZIP!

Thanks! Please Check Your Inbox!
Want to win one of our awesome Tower shirts?
Tell your friends about the package!
