[Git] Switch branches with git switch

Created on November 28, 2026

You can use git switch to change the branch you are working on. Introduced in Git 2.23, this command focuses on switching branches and creating new ones.

Switch to an existing branch

Specify the branch name to switch to.

git switch feature

On success, Git prints a message like:

Switched to branch 'feature'

Create a new branch and switch to it

With the -c (--create) option, you can create a new branch and switch to it in one step.

git switch -c new-feature

Example output:

Switched to a new branch 'new-feature'

To start the new branch from a specific commit or branch, add that reference at the end.

git switch -c new-feature main

References

Git