by Sai gowtham

How to create a branch from master in Git

In this tutorial, we are going to learn about how to create a branch from master in git.

Creating a branch from master

  1. First, you need to move to a master branch using the git checkout command followed by the master.
git checkout master

Note: if you are already in the master branch you don’t need to run the above command.

  1. Create a new branch based on the master by using the below command.
git branch my-new-branch
  1. Now, Switch to the new branch using the git checkout command.
git checkout my-new-branch