Skip to content

git checkout not respecting case #2066

Closed
@ghost

Description

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

- Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
64-bit

$ git --version --build-options

git version 2.20.1.windows.1
cpu: x86_64
built from commit: 7c9fbc07db0e2939b36095df45864b8cda19b64f
sizeof-long: 4
sizeof-size_t: 8

- Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?

> cmd.exe /c ver

Microsoft Windows [Version 6.1.7601]

- What options did you set as part of the installation? Or did you choose the
defaults?

> type "C:\Program Files\Git\etc\install-options.txt"

Editor Option: Notepad++
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled

- Any other interesting things about your environment that might be related
to the issue you're seeing?

N.B. I have tried setting the global git config setting ignorecase = false but it doesn't have any effect on git checkout.

Details

- Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other
Bash / MINGW64

Repro Steps

1.
This shows that I'm on the master branch (highlighted with * and green font) with everything up to date. I also have an existing feature branch called feature/Fix-Code-Warnings

git checkout master
git pull
git branch

image

2.
This shows that I have successfully checked out the existing feature/Fix-Code-Warnings feature branch (highlighted with * and green font) with everything up to date with the remote branch.

git checkout feature/Fix-Code-Warnings
git branch
git pull

image

3.
This appears to show that I have successfully checked out the existing feature/Fix-Code-Warnings feature branch (Switched to branch 'feature/fix-code-warnings').

However the existing feature branch is NOT active (NOT highlighted with * and green font) as it was in step 2 above.

Also it is not tracking the remote branch as in step 2 above; it effectively has create a new local branch with the same name as the existing branch but with a different case.

git checkout feature/fix-code-warnings
git branch
git pull

image

Expected Result
I would have expected that the git checkout feature/fix-code-warnings command in step 3 above would have:

  1. failed with a message something like: error: pathspec 'feature/fix-code-warnings' did not match any file(s) known to git
  2. or instead of creating a new local branch with the same name but different case; instead it would have checked out the existing branch. So command git checkout feature/fix-code-warnings would have returned Switched to branch 'feature/Fix-Code-Warnings'.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions