I have seen git branch <newBranchName>
will create a new branch from the current branch. So for example if my current branch is master
then git branch build5
will create a new branch build5
based on master
.
But if my current branch is master
and I have another branch build3
and I want to create a new branch build6
based on build3
, how can I do that? Is it possible to do it without switching from my current branch master
?
Thanks
Try this
git branch build6 build3
or
git checkout -b build6 build3
As you can see, git branch
takes an optional parameter of a destination branch or commit from which to branch off of.
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