Tuesday, June 2, 2020

Create new branch in GitHub

Note: OS Windows
Way 1:
Create new branch from the current branch and automatically switch to it.
$ git checkout -b <branch_name>

Way 2:
1. Create a new branch on the repository
$ git branch <branch_name>
2. Switch to the new branch from current branch.
$ git checkout <branch_name>

Way 3:
1. Create new branch and can specify a different branch which want to create the new branch.
$ git checkout -b <branch_name> <branch-name_which_creates_the_new_branch>

List all the branches in the repository
$ git branch