Re: [PATCH v2 0/3] config: read both home and xdg files for --global

Chris Torek <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <CAPx1GvcDNx4BUPQkVjbKxYLxTJ=StvLC43R0S_2=T0R8NKbZ7w@mail.gmail.com>
On Sun, Aug 23, 2026 at 3:31 AM Delilah Ashley Wu
<[email protected]> wrote:
>
> Hi all, thanks for your patience. Here's my reroll.
>
> As reported in [1], `$HOME/.gitconfig` and `$XDG_CONFIG_HOME/git/config`
> are both valid global configuration locations. However, when both files
> exist, `git config list --global` only reads from the former location
> whereas `git config list` (without `--global`) reads from both. The same
> issue was reported for `git config get` in [2]. This inconsistency has
> no good justification and contradicts the documented behaviour.
>
> Suppose that `$HOME/.gitconfig` contains:
>     [home]
>         config = true
>
> and `$XDG_CONFIG_HOME/git/config` contains:
>     [xdg]
>         config = true
>
> Then, listing with `--global` shows only the home config:
>     $ git config list --global --show-scope --show-origin
>     global  file:/Users/delilah/.gitconfig    home.config=true
>
> and getting the XDG configuration entry with `--global` will fail:
>     $ git config get --global xdg.config; echo $?
>     1
>
> Git still reads the XDG config as part of its effective configuration,
> as shown by listing the configuration without `--global`:
>     $ git config list --show-scope --show-origin
>     global  file:/Users/delilah/.config/git/config    xdg.config=true
>     global  file:/Users/delilah/.gitconfig            home.config=true
>
> The documentation, quoted in [1] and [2], states that `--global` should
> read from both files ...

I have a related question: which of the global file(s) does

    git config --global --edit

edit? Which one(s) should it edit?

Chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.