How To Create a New Branch in Git-DecodingDevOps
How To Create a New Branch in Git-DecodingDevOps
to create a new branch in git, open your command prompt or git bash and enter into your cloned git repository.
once you entered in your git repository you will be in master branch by default.
here 'simple-java-maven-app' is my git repository.
Create a New Branch Git Command Line
now we are in master branch, lets create a new branch name called 'sit' from master branch. To create new branch we use git branch command.
git branch <branch_name>
DeCodingDevOpS@pc MINGW64 /d/ddevops/simple-java-maven-app (master) $ git branch sit DeCodingDevOpS@pc MINGW64 /d/ddevops/simple-java-maven-app (master) $ git branch * master sit
git branch command will show you all branches in git, you can see my 'sit' branch is created.
Switch to Your New Branch
just now i have created a branch named sit. lets now enter or switch to that branch by using git checkout command.
git checkout <branch_name>
Now you can work in your newly created branch