DEV Community

Cover image for Git Switch
Kumar Nitesh
Kumar Nitesh

Posted on

2 2

Git Switch

Another unknown command, but with a disclaimer

THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.

How do I used to switch branch

// switch to existing branch
$ git checkout <existing_branch>
// create and switch to new branch
$ git checkout -b <new_branch>

How I have started switching branch now

// switch to existing branch
$ git switch <existing_branch>
// create and switch to new branch
$ git switch -c <new_branch>

All git switch options

git switch [<options>] [--no-guess] <branch>
git switch [<options>] --detach [<start-point>]
git switch [<options>] (-c|-C) <new-branch> [<start-point>]
git switch [<options>] --orphan <new-branch>

Enter fullscreen mode Exit fullscreen mode

Read More

Kumar Nitesh

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay