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

sharp edges in Git configuration files

From
Chris Torek <chris.torek@gmail.com>
Date
Oct 31, 2026, 02:56 UTC
Message-ID
<CAPx1Gvd3rAcgDf-rBPOuZFf2=Y+=JxJDdr6AJTvdtpL6Vsk43w@mail.gmail.com>
(let's try this again and see if gmail html-izes AGAIN on me...)

This isn't any kind of serious bug, but I have been playing with Git configuration files to determine a lot of precise details about behavior when reading or changing them, both with "git config" and with the implicit changes made by "git branch", "git remote", and other internal operations.

Anyway, one edge case that causes problems occurs if a user manually edits a ".git/config" file to add include directives. For instance, it's possible to take one or more [remote] or [branch] sections out into a separate file. The following "ed" command will do this (not very safely, don't do it on any repo you care about, just in case):

ed - .git/config <<'END'
/^\[remote /,$w .git/inc-remote
/^\[remote /,$d
a
[include]
        path = inc-remote
.
w
q
END

after which some "git remote" operations that try to update the remotes just fail bizarrely.

(Note: gmail may have whacked white space above, I've set it to send plain text but gmail is...what it is.)

The obvious thing with "doctor it hurts when I do this" is of course "well don't do that", and nobody should be splitting their .git/config into multiple included sub-config-files. But, in the spirit of robust software (and perhaps just as leftover bits?), it might be wise to make Git ignore include lines in config files that are intended to be Git-managed directly, such as .git/config.

Chris
Next: brian m. carlson
Message 1 of 2 in “sharp edges in Git configuration files”
  1. Chris TorekOct 31, 2026
  2. brian m. carlsonOct 31, 2026

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.