Subject: Re: git may delete current branch on case insensitive file system (Mac)

From: Junio C Hamano <[email-masked]>
Date: Fri, 15 Aug 2025 08:41:40 -0700

Richard Carlsson <[email-masked]> writes:

> This was a fun one. I accidentally upcased the first letter of a
> branch beginning with "d" instead of
> upcasing the -d option as I had intended, with a surprising result
> (Mac OS). Easily reproduced:
>
> % git checkout -b dummy
> Switched to a new branch 'dummy'
> % git branch -d dummy
> error: cannot delete branch 'dummy' used by worktree at '/Users/riccar/...'
> % git branch -D dummy
> error: cannot delete branch 'dummy' used by worktree at '/Users/riccar/...'
> % git branch -d Dummy
> Deleted branch Dummy (was c32dfb2).
> % git log
> fatal: your current branch 'dummy' does not have any commits yet
>
> On Linux, you instead get
>
> % git branch -d Dummy
> error: branch 'Dummy' not found

Perhaps you want to opt into the reftable backend before everybody
else does?  Because it does not store each reference (branches, tags
and their friends) as a file on the filesystem, it would sidestep
the above issue case-challenged filesystems has.