Using the slash character in Git branch name

后端 未结 6 976
孤城傲影
孤城傲影 2020-11-22 11:28

I\'m pretty sure I saw somewhere in a popular Git project the branches had a pattern like \"feature/xyz\".

However when I try to create a branch with the slash chara

6条回答
  •  忘了有多久
    2020-11-22 12:00

    In my case, I forgot that there was already an unused labs branch. Deleting it solved the problem:

    git branch -d labs
    git checkout -b labs/feature
    

    Explanation:

    Each name can only be a parent branch or a normal branch, not both. Thats why the branches labs and labs/feature can't exists both at the same time.

    The reason for this behaviour is that the branches are stored in the file system and there you also can't have a file labs and a directory labs at the same level.

提交回复
热议问题