0

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

1 Answers1

3

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.

mipadi
  • 398,885
  • 90
  • 523
  • 479
  • Ok. How do you know in git that new-branch is a from a of branch-to-start -from? I did this, but git does not seem to indicate the parent branch, at least in local – 1lostball Feb 07 '15 at 15:09
  • @1lostball: That's a bit tricker. See this answer: http://stackoverflow.com/a/3162929/28804 – mipadi Feb 08 '15 at 21:43