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
- First, you need to move to a master branch using the
git checkoutcommand followed by the
git checkout master
Note: if you are already in the master branch you don’t need to run the above command.
- Create a new branch based on the master by using the below command.
git branch my-new-branch
- Now, Switch to the new branch using the
git checkout my-new-branch