Assume we have a branch Rel1 on Stash hosted git repo..and when we try to create a branch Rel1/JIRA1234 , we are getting an error stating the branch cannot be created, its name conflicts with an existing branch.
There is no such branch on the server. Are there any rules governing branch naming ?
Hi Vijay,
This is indeed a Git restriction and relates to how Git manages branch names (actually refs). Have a look in your .git/refs/heads directory and you will understand the restriction.
You can reproduce this behavior on the command line too. For example:
$ git branch Rel1 $ git branch Rel1/JIRA1234 fatal: cannot lock ref 'refs/heads/Rel1/JIRA1234': 'refs/heads/Rel1' exists; cannot create 'refs/heads/Rel1/JIRA1234'
Regards,
Ben
Branches are not tree structures like they are in base ClearCase for example. You can create a branches in directories as a way to group them together. So for example if Rel1 wasn't a branch (the first line above was not executed), you could create Rel1/JIRA1234 as a well to group various Rel1 branches together.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Ben & Rich...that makes a whole lot sense now. We now plan to create branches using "-" instead of "/". cheers Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I wouldn't recommend that. A lot of features in both Stash and SourceTree take advantage of the "/" naming convention to let you treat similar branches similarly (i.e. feature/* branches, etc) I'd instead just try not to have a branch with the unadorned base name (i.e. Rel1 in this example). But that's just my thought.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would echo Tim's statement, and suggest having a look at your branching options in more detail. Some information can be found here: https://confluence.atlassian.com/display/BitbucketServer/Using+branches+in+Bitbucket+Server Some examples of branch names in this model are: release/1.0 release/2.0 bugfix/JIRA-123-a-serious-bug feature/JIRA-456-a-new-feature
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.