Duplicate branch

hi! in our project yesterday a duplicate branch showed up as I was merging my branch with the development branch. it was called the same as mine except mine had a capitol first letter and the duplicate didn’t. it wasn’t there before I started the pull request so it somehow just appeared. I managed to resolve the problem for me but after talking to my group leader about it he mentioned that other members in the group have experienced the same problem so I wanted to report the problem here so you can look into it and resolve it so it doesn’t happen to others as it can create big problems if they are not careful.

1 Like

@Ramona196
Regarding duplicate branch in GIT, as of my best knowledge it’s not possible. Two branches cannot have the exact name simultaneously, say there are in local or in remote.

GIT has placed very little restriction on branch names for instance : slashes in branch names are perfectly fine. And taking your example itself, the difference you stated in the query is the one of the letter in the word was capital.

Git branch names and tag names, and all other references names are case-sensitive.

And thus these those two branches are different.

1 Like

Hey there, welcome to the GitHub Support Community! I’ve never had this issue before (my branches are always lowercase) but I imagine GitHub automatically converts your branch to all lowercase characters to prevent some type of issues from arising. Git branch names are case-sensitive too.

I’ve heard that on certain systems branches are case-insensitive, but in this case I don’t imagine that being a consideration. Hope this helps :slight_smile:

1 Like

Hi, I know they aren’t exact duplicates but the one that just showed up on github was empty and didn’t exist in the remotes on visual studio only on github so it was as if some bug had made it.

One branch created on GitHub without any triggers that too with somewhat same name, now that looks like a bug to me too.
Let me too try to find more information on this, in case I find something.

One scenario that I think can cause such an issue is.

Command used to create a branch abc with:

git branch remotes/origin/abc

And then also by

git branch abc

And viewing in local

$ git branch --all
* master
  remotes/origin/abc
  remotes/origin/abc

What actually happens it create a branch in refs/heads/remotes/origin/abc and not in refs/remotes/origin/abc

Hope it makes sense. :sweat_smile:

@Ramona196 please do share any information so that it can be investigated in detail.

And do share if you find the real root cause.

1 Like