4

My co-worker switched to a branch mistakenly using caps for the branch name. Everything seemed to work fine for him. He made a commit and pushed it.
Now however, doing a 'git branch' does not show the previous lower case branch name, and instead the upper case version, but there is no asterix (*) next to the branch name (see the image below).

[brettmac15:ehs-hybrid-prototype-2 kulpreetalagh$ git branch
    UX
    development
    master

[brettmac15:ehs-hybrid-prototype-2 kulpreetalagh$ git status
On banch ux
You branch is up-to-date with 'origin/ux'.
nothing to commit, working tree clean

brettmac15:ehs-hybrid-prototype-2 kulpreetalagh$

Is this a bug, did he do something wrong, or is there a way to fix this?

6
  • Try renaming the branch to its "real" name : git branch -m ux Commented May 3, 2017 at 7:15
  • What is the branch name in the refs/ folder ? ls .git/refs/heads/ Commented May 3, 2017 at 7:18
  • What is the branch name in HEAD ? cat .git/HEAD Commented May 3, 2017 at 7:18
  • 1
    This is one of those case-folded branch name problems, because you are on a Mac using an HFS+ file system that is set to be case-insensitive. Your Mac believes that ux and UX are the same file, while your Git believes they are different branches. You can fix various names in your repository but you and your co-worker must agree to one particular capitalization and stick with it. Commented May 3, 2017 at 8:46
  • 1
    Unfortunately git is confused when it comes to case folding like this. You're best off by checking out the correctly named branch name. Specifically, git will trust the file system that says "Sure, I found a file inside .git/refs/heads/ux and this is its contents" but then use case sensitive comparison when determining if a branch it is currently listing is the current one. Commented May 3, 2017 at 9:24

1 Answer 1

3

This is from two comments above by @torek & @LasseVågsætherKarlsen

This is one of those case-folded branch name problems, because you are on a Mac using an HFS+ file system that is set to be case-insensitive. Your Mac believes that ux and UX are the same file, while your Git believes they are different branches. You can fix various names in your repository but you and your co-worker must agree to one particular capitalization and stick with it.

Unfortunately git is confused when it comes to case folding like this. You're best off by checking out the correctly named branch name. Specifically, git will trust the file system that says "Sure, I found a file inside .git/refs/heads/ux and this is its contents" but then use case sensitive comparison when determining if a branch it is currently listing is the current one.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.