0

I am on local master branch and created subbranch. I then tried to push it, so that others can access to this branch and work on it too, but it failed. Then I thought I should create a remote branch, so I ran

git push origin subBran

The branch was successfully pushed to remote; however, the branch is not off master, but parallel to master...

What command(s) should I use to have the subbranch off master, and then push to remote?

I think I want remotes/origin/master/subBranch

Current status:

$ git branch -a
* subBranch
  master
  remotes/origin/subBranch
  remotes/origin/jc_some5
  remotes/origin/master
SQB
  • 3,926
  • 2
  • 28
  • 49
user2751691
  • 401
  • 2
  • 10
  • 32
  • Related: http://stackoverflow.com/a/4288660/758446 – BlackVegetable Mar 13 '15 at 18:26
  • @BlackVegetable : Hi, could you help providing some commands please? I did research but some are not very related. I was worried that trying randomly would mess up the branches... Thanks so much. – user2751691 Mar 13 '15 at 18:29
  • It sounds like you've done this correctly. What do you mean by "parallel to master"? – isherwood Mar 13 '15 at 18:36
  • 1
    Branches are not children of one another. Your expectation of `.../master/subBranch` is incorrect. – isherwood Mar 13 '15 at 18:37
  • @isherwood : Hi, thank you for your reponse, I want it to be off master. Because previously, it was remotes/origin/subBranch instead of remotes/origin/master/subBranch Thank you. – user2751691 Mar 13 '15 at 18:37
  • Further, you'll notice that your local branch is not listed as `master/subBranch` either. – isherwood Mar 13 '15 at 18:38
  • @isherwood : Oh, thanks for pointing that out. My confusion is, then how do I know subBranch is branched off master please? Thank you. – user2751691 Mar 13 '15 at 18:38
  • http://stackoverflow.com/questions/3161204/find-the-parent-branch-of-a-branch – isherwood Mar 13 '15 at 18:39
  • @isherwood : So what I did was correctly? I was confused because master and subBranch are both under directory of origin. Thank you. – user2751691 Mar 13 '15 at 18:44
  • You can't have branches named `master` and `master/subBranch` in one repository - `master` has to be either branch or directory name, not both. Also, branches in git are just references to commits, and their names aren't related to content in any way. – Frax Mar 16 '15 at 17:37

0 Answers0