git checkout -b <branchname>
Create a new branch and switch to it
This git checkout -b
command creates a new branch with the specified name, and then switches to that branch. It is a combination of two individual commands: git branch <branchname>
which creates a new branch, and git checkout <branchname>
which switches to the new branch.
Potential variations include:
git checkout --orphan <branchname>
: Creates a new orphan branch without any commit history.git checkout -b <branchname> <commit>
: Creates a new branch with the specified name and starting from the specified commit.
Sign in to enable bookmarking, reminders, progress-tracking and more...
Related
git branch <branchname>
git checkout -b <branchname1> <remote>/<branchname2>
git checkout <branchname>
git checkout -
git checkout --<pathname>
git checkout HEAD <pathname>
git checkout --ours <pathname>
git checkout --theirs <pathname>
git checkout -m <branchname>
git checkout --orphan <branchname>
git checkout -b <branchname> <commit>
git checkout -t <remote>/<branchname>