Git – Create New Branch and Checkout – In One Command

Each time you want to commit a bug or a feature, you need to create a branch for it.

To create a new branch there is a git branch command.

After you have created a branch, you need to switch in this branch using a git checkout command.

But it is also possible to create a new Git branch and switch in this branch using only one git checkout command with -b option.

Cool Tip: Delete remote and local Git branches easily! Read More →

Сreate Git Branch and Checkout

Create a new Git branch and checkout:

$ git branch <branch_name>
$ git checkout <branch_name>

Create a Git branch and checkout in one command:

$ git checkout -b <branch_name>

Cool Tip: How to create a new local Git branch from another branch, tag or commit and push it to remote Git repository! Read More →