I am creating a branch with this command
git branch my-branch
and switch a newly created branch with another command
git checkout my-branch
Any idea about creating a branch and switch with one command
I am creating a branch with this command
git branch my-branch
and switch a newly created branch with another command
git checkout my-branch
Any idea about creating a branch and switch with one command
You can use checkout with -b to specify a new branch name
git checkout -b my-branch
From the docs
Specifying
-bcauses a new branch to be created as if git-branch were called and then checked out.
git switch -c newBranchName
it will create a new branch starting at the current head official docs and then switch to that branch