Often it is useful to create a new branch when you want to commit features or fix bugs. Follow the easy instructions below to create and checkout a branch in Git.
Two Simple Choices
There are a couple of straightforward ways to create a new branch in Git. The first method requires two steps, using the git branch and git checkout commands. The second method combines git checkout with -b into a single step.
Option 1
Branch and checkout in two steps with git branch and git checkout.
$ git branch
$ git checkout
Option 2
Branch and checkout in one step with git checkout and -b.
$ git checkout -b
Tip! Don’t forget to check you are on the correct branch.
Your info will only be used for comments. No Gmail.