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

From: engdoc <hidden>
Date: 2025-08-21 04:30:00


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



Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help