In this tutorial, you’ll learn how to create a new branch from another branch with git and switch to it.
When you want to branch off from another branch you can use the following syntax.
$ git checkout -b <new_branch> <old_branch>
<new_branch> should be replaced with the name of your new branch, while the
<old_branch> is the name of the branch you want to branch off.
How to create a branch from develop branch in Git
To create a new branch from a
develop branch, you can run the following command:
$ git checkout -b myFeature develop
This short command is the same as if you were running:
$ git checkout develop $ git branch myFeature $ git checkout myFeature
To push the current branch and set the remote as upstream, you can use:
$ git push --set-upstream origin myFeature
If you find this post useful, please let me know in the comments below.
Want to share this with your friends?
Incoming search terms: