Make a Branch
Every commit belongs to at least one branch. The default branch is typically named master
or main
.
View current branch
To view which branch you're current at, use git branch
:
This tells that I'm currently on the master
branch.
Create a new branch
You can do this in two steps:
Create a branch:
git branch <name>
Change to that branch:
git checkout <name>
Or do it in just one step: creating then changing to that branch: git checkout -b <name>
.
Here I create a branch called new
. When calling git branch
again it shows I'm on branch new
.
Last updated