0

I am having trouble understanding exactly how I need to create a local feature branch to put customizations into. I have consulted some online resources which only confuse me further.

I have created the remote branch via stash called feature/mycustomization for people to create pull requests against.

Now from command line do I have to do a git checkout -b to create a local branch from which to push the changes to feature/mycustomization? Also, does the name of my local branch have to match up with the remote branch due to convention?

Or is there a command which pulls the code from the remote branch feature/mycustomization created in step one and automatically creates the local branch?

I would appreciate some step by step instructions if possible.

Cheers, Bob

bob dabelina
  • 507
  • 5
  • 20

1 Answers1

1

If the remote branch exists, then git checkout <branch_name> should be sufficient enough to both create the local branch and properly set its upstream tracking branch.

If it does exist but there is no remote tracking branch set for it (you can verify this with git branch -vv), then you'll have to do a bit more work.

On the branch, run the command git branch -u origin/<branch_name>.

Makoto
  • 104,088
  • 27
  • 192
  • 230
  • When I try git check , I get the following error: pathspec 'feature/' did not match any file(s) known to git. Do you know what could be missing? I also tried git checkout feature/ with the same error. Thanks,Bob – bob dabelina Jul 28 '15 at 22:45
  • Also when I do a git branch -a , I do not see the remote branch at all in the list. Hopefully that gives some clues. – bob dabelina Jul 28 '15 at 23:15
  • Hmm. Okay then. What does `git branch -r` give you back? Add it to the question. – Makoto Jul 28 '15 at 23:16
  • git branch -r still doesn't return the remote branch in the list. – bob dabelina Jul 29 '15 at 01:42
  • I'm not convinced it's being identified as a branch, then. – Makoto Jul 29 '15 at 02:13
  • Hm, not sure what you mean. I can clearly see it along with the other branches in stash. So are there any properties to check in stash which would provide some clues? – bob dabelina Jul 29 '15 at 05:13