Github
Github

Reputation: 39

Can I create a new branch on master when working on another branch?

I can't seem to find any information regarding this, here is the scenario:

I'm working on a feature branch. A bug gets reported. So I switch to my master branch then create a new branch by checkout with the -b switch

git checkout -b bugbranch

What happens if I issue the command on a branch other than master? Will it create a new branch under master or create a branch off of the other branch?

Upvotes: 0

Views: 61

Answers (2)

jurez
jurez

Reputation: 4667

You can do

git branch branchname startpoint

This will create a new branch with name branchname and starting point at startpoint. For more information, consult git branch --help.

Upvotes: 2

iElden
iElden

Reputation: 1280

The new branch is created from the current branch you are on

Upvotes: 2

Related Questions