Open that folder and right click on it and press “Git Bash Here” option as shown below. For the demo, I used E drive and created a folder “git-local”. Now go to the directory where you want to create a local repository. If you have not done so, you may install it by visiting this website and download/install it on your machine. I have installed Git software on windows machines with Git Bash. However, for learning how to create branches by command-line, we will create a new branch based on master branch. Note: If you look at the above graphics (after creating a repo), it shows the master branch is already created. Our repository now contains two files as shown below: If you check the “Initialize this repository with README” option then the new repo should contain a file “README.md”.įor branch testing, let us create a file in this repository so that we can see later what a branch contains.įor the demo, I have created ‘file-1’ and just a line of text. Create a local branch based on the master branch using Git BashĪfter creating an account on Github website, you may create a repository that stores all your files (including code files).Running Git Bash on the local machine and pulling the Github repo.The next section describes the following: For beginners, what actually creating a branch involves and what it produces should keep reading the tutorial. If you just required the syntax of how to create a new branch, the above command should work for you. The command for creating new branch locally:Ī local branch namely “hello-git” should have been created.Ī step by step guide of creating branches for beginners Suppose you want to create a new branch in Git with the name of “hello-git”. For details, see the section after the general command below. This tutorial explains how to create a new branch in Git (locally and remotely).
0 Comments
Leave a Reply. |