Create a new git branch from existing branch
To create a new Git branch from an existing branch, you can use the following command:
git branch <new-branch-name> <existing-branch-name>
For example, if you want to create a new branch called "feature/new-login-system" from the existing branch "master", you would use the following command:
git branch feature/new-login-system master
This will create a new branch called "feature/new-login-system" that is based on the current state of the "master" branch.
If you want to switch to the new branch immediately after creating it, you can use the following command:
git checkout -b feature/new-login-system master
This will create the new branch and switch to it at the same time.
Note: The -b
option stands for "branch" and tells Git to create a new branch and switch to it immediately.