

You can later on switch to your new Git branch by using the “git checkout” function. In order to create a new Git branch, without switching to this new branch, you have to use the “git branch” command and specify the name of the Git branch to be created. $ git checkout -b featureĪs you can see, by using the “git checkout” command, you are creating a new branch and you are switching to this new branch automatically.īut what if you wanted to create a Git branch without switching to the new branch automatically? Create Git Branch without switching To achieve that, you will run the “git checkout” command with the “-b” option and add “feature” as the branch name. $ git checkout -b Īs an example, let’s say that you want to create a new Git branch from the master branch named “feature”

Next, you just have to specify the name for the branch you want to create. The easiest way to create a Git branch is to use the “git checkout” command with the “-b” option for a new branch.
