how to Create New Branch and Checkout – In One Command – git


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.

Сreate 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>

Similar Posts:


How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Leave a Comment

Your email address will not be published.

Scroll to Top