1lostball
1lostball

Reputation: 27

Create Branch of Branch in git?

I have master with a branch FooDev in git repository. Master-----FooDev

Can I create a Branch(es) off of FooDev, so: master----FooDev--|-----Sprint1Sue |------- Sprint1Joe

If so how do I so this? Can I see this somehow in my local repo? It does not see I can branch from a branch and git push needs remote branch, but i don't know how/if I can specify a branch as a specific origin.

M

Upvotes: 0

Views: 786

Answers (1)

mipadi
mipadi

Reputation: 411280

Definitely. You can pass an optional argument to git checkout -b to specify where you want to branch from:

$ git checkout -b <new-branch-name> <branch-to-start-from>

Or from git branch:

$ git branch <new-branch-name> <branch-to-start-from>

In fact, you can create a branch off of any commit: branches, tags, even just a commit referenced by its SHA1 hash.

Upvotes: 3

Related Questions