Stash. Duplicate Branches


we are using Git Flow, pushing the branches to Stash. The format has been since the beginning Feature/[Branch Name].

We now can see that few branches are duplicate in the format of: feature/[Branch Name].

The connection between local Source Trees and those branches is broken, until a fresh clone is done.


Also Bamboo is now failing to retrieve commits from any branch starting with feature/.


Bamboo and Stash are hosted on Windows 64Bit.


Any idea how this mismatch of lower to capital letter is occurred? How can we fix it?



2 answers

I had a support case about this a year ago. The short answer is that Stash and Git are case-sensitive, but on Windows, the file system is not and this causes the problem. You should remove the feature/* (or Feature/*) branches from the server and tell everybody to stick to one or the other. (feature/ is a better option, because branches created on the Stash web UI will have this and I think you cannot change that.)

Here is the end of my discussion with support:

Currently, I am instructing the users to either:

  • create the feature branches on the server, pull them to their local clones and use them from there or
  • create the branches with all lower case letters in SourceTree
    in order to avoid this problem. I think I will stick to that for at least a little bit longer. 

I think I understand now what is going on. Both locally and on the server, there is a refs/heads/[Ff]eature folder, created when the first feature branch is created there.
So e.g.:
1.: On the server, there is already at least one feature branch, starting with "f", so the folder also starts with "f".
2.: The local clone is fresh and no feature branches have yet been checked out, so the refs/heads/[Ff]eature folder does not exist yet.
3.: Developer creates "Feature/whatever" (so the local folder is "Feature"), commits to it and pushes this to the server.
4.: The server creates "feature/whatever" and stores the commit there. (For some reason, this is the only time when the conversion of the lower/upper case is successful and the server really does not care about case.)
5.: Developer commits again to the local "Feature/whatever", tries to push it, gets "failed to lock refs/heads/Feature/whatever", because the server has "refs/heads/feature/whatever" (still cannot understand why the case conversion does not work at this point).
(This works the other way around as well, if the first feature branch is created starting with "F", all the branches will be like that. Also when displayed on the web interface of the server.)

I have this problem too since someone create a branch beginning Bugfix/... it's driving me crazy, will try @Balazs Szakmary solution. 

I've since put in a branch naming standard hook from our own plugin (sorry, cheap plug), but unfortunately too late.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

1,909 views 7 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you