Subject: Re: bug: git config --global --unset doesn't unset configs in corner case

From: Junio C Hamano <[email-masked]>
Date: Thu, 09 May 2024 09:23:13 -0700

Mike Hommey <[email-masked]> writes:

> When both ~/.gitconfig and ~/.config/git/config exist, git will read
> both. But when using `git config --global --unset`, it will only touch
> the first one. So unsetting config items from ~/.config/git/config is
> not possible from the command line when ~/.gitconfig exists.

Interesting observation of an understandable behaviour.

I think the original intent of limiting the writing to just one was
to avoid having both files in the first place.  When both do exist
already, I am not sure what the right behaviour on the write side
should be.  We could special case "--unset-all" and remove from
both, but "--unset" is to remove just one, so when the reading side
reads from both, it becomes "which one to remove"?

Comments from those who are more familiar with the "git config" are
certainly appreciated.

Thanks.