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

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
45,614 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
284,472 students enrolled
40 hours of video content
View Course
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
130,921 students enrolled
21 hours of video content
View Course