I am creating a branch with this command:
git branch my-branch
and switch to a newly created branch with another command:
git checkout my-branch
Any idea about creating a branch and switching with one command
You can use checkout
with -b
to specify a new branch name
git checkout -b my-branch
From the docs
Specifying
-b
causes a new branch to be created as if git-branch were called and then checked out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With