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

[RFC] Allow includeIf.hasconfig to take precedence over includeIf.gitdir

From
Eengdoc <engdoc@aliyun.com>
Date
Aug 21, 2025, 04:29 UTC
Message-ID
<a903afc8-9bf6-4ba8-bdab-87a76adf631e.engdoc@aliyun.com>

Hello Git developers, I would like to request a feature regarding the priority of conditional includes in Git configuration.

Background: Currently, when both includeIf.gitdir and includeIf.hasconfig conditions match for a repository, Git always processes gitdir first, regardless of the order in the config file. This behavior is hardcoded and cannot be changed by users.

My use case: In my workflow, due to the current priority order, the gitdir include always takes precedence, making it impossible to override it with hasconfig when both match.

Request: I would like to have a way to make includeIf.hasconfig take precedence over includeIf.gitdir, either by: Allowing users to specify the priority/order of conditional includes, or

Always processing hasconfig before gitdir, or
Providing a configuration option to control this behavior.

Motivation: This would allow more flexible and context-aware configuration setups, especially for teams or users who want to have per-repository overrides based on the presence of certain config files, without being constrained by the repository path.

Thank you for considering this feature request!
Best regards
Next: Junio C Hamano
Message 1 of 2 in “[RFC] Allow includeIf.hasconfig to take precedence over includeIf.gitdir”
  1. engdocAug 21, 2025
  2. Junio C HamanoAug 25, 2025

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.