Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 830 Bytes

create-a-new-branch-with-git-switch.md

File metadata and controls

27 lines (20 loc) · 830 Bytes

Create A New Branch With Git Switch

As of Git 2.23, there is a new command in town for change and creating branches -- git-switch.

As a git user, you may be used to using git checkout -b my_branch to create and switch to a new branch called my_branch. The git-checkout command can do that and a lot more. In order to reduce some confusion and create a more explicit command for this kind of action. That's what brought about git-switch.

Create and change to a new branch with git-switch and the -c flag:

$ git switch -c my_new_branch

The -c flag is short for --create and the docs describe it as "a convenient shortcut for:"

$ git branch <new-branch>
$ git switch <new-branch>

See man git-switch for more details.