To create a new branch in Git, you can use the git checkout
command followed by the flag -b
and then type the name of the branch you need to make.
For example, to make a branch called my-new-branch
you can use the git checkout
command like this,
# Creates a new git branch
git checkout -b my-new-branch
This will create a branch called my-new-branch
and will automatically check you into it (aka, set the current working branch to my-new-branch
).
That's all 😃!