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.
Branch and checkout in two steps with git branch and git checkout.
$ git branch
$ git checkout
Branch and checkout in one step with git checkout and -b.
$ git checkout -b