Git Branch
A branch represents a separate line of development. When you start to work on a new feature, you usually create a new branch off master branch or any other branch which is later merged back to the main branch.
Create a New Git Branch
The branch command lets you create a new branch in your local git repository. After creating a branch, you need to switch to that branch using the checkout command.
Syntax
git branch <branch-new-name>
Example: git branch user_signup
You can also create and switch to a new branch using a single command.
The checkout -b command lets you create and switch to a new branch using a single command.
Syntax
git checkout -b <branch-new-name>
Example: git checkout -b user_signup
Rename a Git branch
Sometimes you may need to rename a branch that is already created.
Syntax
git branch -m <branch-old-name>
Example: git branch -m user_signup users_signup
The preceding command renames a branch locally. To reflect the changes in the remote branch, you need to push it to the remote repository using the push command.