Git create new branch from current
To create a new branch from the current branch in Git, you can use the following command:
git branch <new-branch-name>
Replace <new-branch-name>
with the name you want to give to your new branch.
For example, if you want to create a new branch called feature/new-login-system
, you would run:
git branch feature/new-login-system
This will create a new branch with the specified name, but it won't switch you to that branch. To switch to the new branch, you can use:
git checkout <new-branch-name>
So, in this case:
git checkout feature/new-login-system
This will switch you to the new branch, and you can start making changes and committing them to that branch.
Alternatively, you can create a new branch and switch to it in one step using:
git checkout -b <new-branch-name>
This will create a new branch with the specified name and switch you to that branch. For example:
git checkout -b feature/new-login-system
This will create a new branch called feature/new-login-system
and switch you to that branch.