Git remote naming issue

Answered

Hi there,

 

Recently I've noticed an odd behaviour that I, as of yet, cannot explain. 

 

Our current Git naming schema is quite standard, "<branch type>/<branch name>".

However, for our feature branches (with branch type = "feature"), which is also how they are named in BitBucket, creating a new local branch with IntelliJ changes the initial lower case f in "feature" to a capital F to "Feature".

Additionally the remote branch is set to "origin/Feature/...". And upon pushing to this remote branch, a new branch is created. 

 

Needless to say this behaviour is annoying. I doubt that this issue is with BitBucket because creating branches using the command line tools does not result in this issue. So far I haven't been able to find an IntelliJ configuration that would lead to this renaming. 

 

Any suggestions?

 

Thanks for reading!

2
11 comments

Are you on Windows? Please check this article: https://confluence.atlassian.com/bitbucketserverkb/case-sensitivity-in-branch-name-causes-issue-816521190.html for the workarounds.

>using the command line tools does not result in this issue. 

Check that you use the same git client in Settings(Preferences on Mac) | Version Control | Git | Path to Git executable:

0
Avatar
Permanently deleted user

Apologies. 

IntelliJ IDEA 2018.2.3 (Ultimate Edition)
Build #IU-182.4323.46, built on September 3, 2018
Licensed to XXXXXXXX
Subscription is active until XXXXXXX
JRE: 1.8.0_152-release-1248-b8 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6

 

I wasn't sure if it was the exact same binary of Git, but the version was the same on both (2.15.2). I changed the binary that IntelliJ uses to see if that makes a difference and will try it out shortly.

0
Avatar
Permanently deleted user

Using the same binary does not help. Additionally, IntelliJ seems to loose the remote now - I can't pull from it and have to reset the upstream from time to time. Seems like I have to revert to using git on the command line - very frustrating issue.

0

I could not reproduce the described behavior. When using Checkout As action on a remote branch, the case is preserved. How exactly do you create a local branch?

 

>the initial lower case f in "feature" to a capital F to "Feature". Additionally, the remote branch is set to "origin/Feature/...".

What are the actual file names of ref files in .git/refs/heads and .git/ref/remotes? Are they changed on branch creation?

 

> Additionally, IntelliJ seems to lose the remote now

Please clarify what do you mean? What exact errors do you get? IDE totally relies on git config in regards to remotes.

0
Avatar
Permanently deleted user

It was fine until yesterday and then it started again. This time I even created the branch in the shell, and still I got a similar behaviour. An important note is that command line "git pull" works just fine.

In IntelliJ the branch name is still wrong, but in command-line git the name is correct.

0

@Ted, please open a ticket in support with logs and git config attached.

0

Hej Ted, did you find any solution? this is exactly the problem I am facing right now

1

Dmitriy Smirnov I am facing this same issue as well with version 2021.2.3 and Build #IU-212.5457.46

0

I'm facing the same issue. However, it also appears to happen directly from command line when I push a new branch like feature/bla. Workaround is not to use feature/ prefix; but the reason it happens I don't understand. I work with github remote.

0

Since it happened when using command line directly - it looks like it is a git vs case-insensitive file system (Windows or macOS) related issue. Check this answer on github:  https://github.com/desktop/desktop/issues/10621#issuecomment-696783727

Another possible workaround is to run:

git pack-refs --all

This will make git pack the branches/refs names in a text file .git/packed-refs, instead of keeping a separate file for each branch/reference.

0

Please sign in to leave a comment.