git/list[1] front-page[2] threads[3] people[4] search[5] about
 

bug: git branch -d and case-insensitive file-systems

From
ADAaron Dufour <thedufer@gmail.com>
Date
Aug 24, 2015, 16:11 UTC
Message-ID
<CAJrRhQz1UmnDi6Giejetfoh3aPX08aYcgY-neZfcKjpUav0=sA@mail.gmail.com>

I use git (2.2.1) on OS X (10.9.5) and recently my repo got into a bad state. I think this involves a mis-handling of case-insensitive file systems.

This reproduces the problem:
    > git init
    Initialized empty Git repository in /Users/aarond_local/code/git-test/.git/
    > git commit --allow-empty -m 'first commit'
    [master (root-commit) 923d8b8] first commit
    > git checkout -b feature
    Switched to a new branch 'feature'
    > git checkout -b Feature
    fatal: A branch named 'Feature' already exists.
    > git checkout -B Feature
    Switched to and reset branch 'Feature'
    > git branch -d feature
    Deleted branch feature (was 923d8b8).
    > git log
    fatal: bad default revision 'HEAD'

This is the behavior when there isn't a case mismatch, which is what I would have expected in the previous case as well:

    > git init
    Initialized empty Git repository in /Users/aarond_local/code/git-test/.git/
    > git commit --allow-empty -m 'first commit'
    [master (root-commit) 48df19f] first commit
    > git checkout -b feature
    Switched to a new branch 'feature'
    > git branch -d feature
    error: Cannot delete the branch 'feature' which you are currently on.
I can also reproduce the issue on git 2.5.0.
-Aaron Dufour
Next: Jeff King
Message 1 of 3 in “bug: git branch -d and case-insensitive file-systems”
  1. Aaron DufourAug 24, 2015
  2. Jeff KingAug 25, 2015
  3. Fwd: bug: git branch -d and case-insensitive file-systemsAaron Dufour, Aug 25, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.