Git checkout into new branch
To create a new branch and switch to it using Git, you can use the following command:
git checkout -b <branch-name>
Replace <branch-name>
with the name you want to give your new branch.
For example, to create a new branch called "feature/new-login-system", you would run:
git checkout -b feature/new-login-system
This will create a new branch with the name "feature/new-login-system" and switch your current branch to it.
If you want to create a new branch and immediately switch to it without creating a new commit, you can use the -
option:
git checkout -b <branch-name> -
This will create a new branch and switch to it without creating a new commit.
Note: If you want to create a new branch from an existing branch, you can specify the name of the existing branch as an argument to the checkout
command. For example:
git checkout -b feature/new-login-system origin/master
This will create a new branch "feature/new-login-system" based on the "master" branch from the remote repository.