Origin /, Remote Control / Origin / Git

I just cloned the repo and started a new branch in Git. I have done this many times without encountering a problem. Tonight, when I tried to use git branch --set-upstream develop origin/develop to set the upstream location, I got this error:

 fatal: Ambiguous object name: 'origin/develop'. 

Reading suggests that this is the result of the same branch name as in the beginning, and in the console / origin. I do not understand the difference between the two, and why they conflict in this way. I typed git branch -a and this was the result:

 * develop master origin/develop remotes/origin/HEAD -> origin/master remotes/origin/develop remotes/origin/master 

I am confused by the difference between origin/develop and remotes/origin/develop , and why this will result in a fatal: Ambiguous object name: 'origin/develop'. error fatal: Ambiguous object name: 'origin/develop'. .

+4
source share
2 answers

I think that, by mistake, perhaps you have a local branch named origin/master . Try running git branch . If there is a branch origin/master , then this.

See if you want to delete this thread. If you can't or don't want to, run git branch --set-upstream develop remotes/origin/develop .

+2
source

I confirm that origin/develop is the name of the local branch instead of the remote link (e.g. remotes/origin/develop )

And branches can have the name "/" in their name: they are called "hierarchical branch names" (see " Using the Slash Character in the Git Branch Name ").
As explained in this thread , which does not allow you to "develop" as the name of the branch. You need to rename it

  git branch -m origin/develop develop git branch --set-upstream develop origin/develop 
+1
source

Source: https://habr.com/ru/post/1447135/


All Articles