Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Stash. Duplicate Branches

federicobarera2 June 15, 2015

Hi,

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?

 

Thanks

2 answers

2 votes
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 15, 2015

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.)

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 15, 2015

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
TAGS
AUG Leaders

Atlassian Community Events