1

I have a branch on my remote which my local repo does not know about. I'm trying to create the branch locally, track and pull, but the branch has a forward slash in it's name.

My results:

$ git branch --set-upstream feature/users origin/feature/users
fatal: Not a valid object name: 'origin/feature/users' 

Do I need to escape the forward slash in the branch name? I've tried quotes as well as backslash.

Draculater
  • 2,280
  • 1
  • 24
  • 29
  • 3
    '/' is only disallowed as the last character of the branch name (http://stackoverflow.com/questions/3651860/which-characters-are-illegal-within-a-branch-name) – Pascal Belloncle Feb 16 '13 at 02:40

1 Answers1

3

The upstream branch must be an existing local branch (local in the sense that it exists in your local repo) before it can be set as upstream. You should fetch from the remote to get the current origin/feature/users before trying to create a local branch that tracks it.

Ryan Stewart
  • 126,015
  • 21
  • 180
  • 199