{"thread":{"id":"64213","subject":"[Feature Request] Support for sharing root-level files across repositories","startedAt":"2025-09-26T08:33:53Z","lastAt":"2025-09-29T21:17:39Z","messageCount":4,"participants":["George Ogden","rsbecker@nexbridge.com","Ben Knoble"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"527405","messageId":"CAJ5EAUw_VN4GXiHYJq0et8oZN0L+AHZz+ROLtK3Hxdp3SEL3=g@mail.gmail.com","threadId":"64213","inReplyTo":null,"subject":"[Feature Request] Support for sharing root-level files across repositories","fromName":"George Ogden","fromEmail":"george.ogden.human@gmail.com","sentAt":"2025-09-26T08:33:14Z","receivedAt":"2025-09-26T08:33:53Z","isPatch":false,"sender":{"key":"george.ogden.human@gmail.com","avatar":null},"body":"Hello Git developers,\n\nFirstly, apologies if this has already been discussed or if there is a\nway to solve this problem that I am not aware of.\n\nMotivation\n\nGit submodules are very useful for sharing directories between\nrepositories. However, in some workflows, there is a need to share a\nsingle file that must live in the repository root.\n\nA concrete example is .pre-commit-config.yaml. I maintain a standard\ntemplate across many repositories. When I add a new hook or update a\nversion, I have to manually update the file in each repository. I\ncould use a submodule for this, but submodules always appear in a\nsubdirectory — not at the root where tools expect this file.\n\nThe same issue arises with other configuration files that need to\nreside at the top level of a project (linters, CI configs, licenses,\netc.).\n\nProposal\n\nIt would be helpful if Git provided a way to share a file across\nrepositories so that it appears at the root of the working tree,\nwithout requiring a separate build step, symlink, or copy operation.\n\nI understand there are alternative approaches (subtrees, packages,\nexternal tooling), but they all involve extra indirection. Having\nfirst-class support within Git for this use case would make it much\nsimpler and more consistent.\n\nThanks\n\nThank you for your work maintaining and evolving Git! I would greatly\nappreciate any feedback on whether this idea has been considered\nbefore, and if there are technical reasons it may not fit Git’s model.\n\nBest regards,\nGeorge Ogden\n"},{"id":"527591","messageId":"03d601dc3166$0f302170$2d906450$@nexbridge.com","threadId":"64213","inReplyTo":"CAJ5EAUw_VN4GXiHYJq0et8oZN0L+AHZz+ROLtK3Hxdp3SEL3=g@mail.gmail.com","subject":"RE: [Feature Request] Support for sharing root-level files across repositories","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2025-09-29T17:25:26Z","receivedAt":"2025-09-29T17:25:40Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On September 26, 2025 4:33 AM, George Ogden wrote:\n>Hello Git developers,\n>\n>Firstly, apologies if this has already been discussed or if there is a way to solve this\n>problem that I am not aware of.\n>\n>Motivation\n>\n>Git submodules are very useful for sharing directories between repositories.\n>However, in some workflows, there is a need to share a single file that must live in\n>the repository root.\n>\n>A concrete example is .pre-commit-config.yaml. I maintain a standard template\n>across many repositories. When I add a new hook or update a version, I have to\n>manually update the file in each repository. I could use a submodule for this, but\n>submodules always appear in a subdirectory — not at the root where tools expect\n>this file.\n>\n>The same issue arises with other configuration files that need to reside at the top\n>level of a project (linters, CI configs, licenses, etc.).\n>\n>Proposal\n>\n>It would be helpful if Git provided a way to share a file across repositories so that it\n>appears at the root of the working tree, without requiring a separate build step,\n>symlink, or copy operation.\n>\n>I understand there are alternative approaches (subtrees, packages, external\n>tooling), but they all involve extra indirection. Having first-class support within Git\n>for this use case would make it much simpler and more consistent.\n>\n>Thanks\n>\n>Thank you for your work maintaining and evolving Git! I would greatly appreciate\n>any feedback on whether this idea has been considered before, and if there are\n>technical reasons it may not fit Git’s model.\n\nI have been thinking about a current use case for this RFE. Consider\nGNU/Configure-based projects where we have config.guess and config.sub in the\nrepository root. These two files are independent of the project itself and truly\nshould be shared and managed from a single authoritative source. It can be a\nreal delay/pain to wait for the project to manually update these two files\nfrom an upstream to get platform support for their project. \n\nIn order to support something like this, we might need a submodule concept\nThat supports something like a link upwards. Or this might be something\nThat could be part of the sparse-checkout infrastructure. I'm not sure, but I\nDo think there is merit to this. It could also apply to organisations that have\ncross-application root certificates that need to be in the same directory\nas the application root.\n\nJust my musings.\n--Randall\n\n"},{"id":"527594","messageId":"CAJ5EAUyfOLZHqs8BKnxzjHXj6H1ZiWSKLimL5smB3ML0KCLEKw@mail.gmail.com","threadId":"64213","inReplyTo":"03d601dc3166$0f302170$2d906450$@nexbridge.com","subject":"Re: [Feature Request] Support for sharing root-level files across repositories","fromName":"George Ogden","fromEmail":"george.ogden.human@gmail.com","sentAt":"2025-09-29T19:32:41Z","receivedAt":"2025-09-29T19:33:20Z","isPatch":false,"sender":{"key":"george.ogden.human@gmail.com","avatar":null},"body":"Hi Randall,\n\nThanks so much for your thoughtful reply. I agree that there would be\na lot of use cases beyond the one I initially mentioned.\n\nI don’t have the technical background to suggest how this might best\nfit into Git, but I’d be very interested to hear more from others on\nthe list about possible directions. My main motivation is simply to\nmake it easier to maintain a single shared file across multiple\nrepositories, without having to copy it around manually.\n\nThanks again for taking the time to engage with this idea. I really\nappreciate it.\n\nBest regards,\nGeorge\n\nOn Mon, 29 Sept 2025 at 19:25, <rsbecker@nexbridge.com> wrote:\n>\n> On September 26, 2025 4:33 AM, George Ogden wrote:\n> >Hello Git developers,\n> >\n> >Firstly, apologies if this has already been discussed or if there is a way to solve this\n> >problem that I am not aware of.\n> >\n> >Motivation\n> >\n> >Git submodules are very useful for sharing directories between repositories.\n> >However, in some workflows, there is a need to share a single file that must live in\n> >the repository root.\n> >\n> >A concrete example is .pre-commit-config.yaml. I maintain a standard template\n> >across many repositories. When I add a new hook or update a version, I have to\n> >manually update the file in each repository. I could use a submodule for this, but\n> >submodules always appear in a subdirectory — not at the root where tools expect\n> >this file.\n> >\n> >The same issue arises with other configuration files that need to reside at the top\n> >level of a project (linters, CI configs, licenses, etc.).\n> >\n> >Proposal\n> >\n> >It would be helpful if Git provided a way to share a file across repositories so that it\n> >appears at the root of the working tree, without requiring a separate build step,\n> >symlink, or copy operation.\n> >\n> >I understand there are alternative approaches (subtrees, packages, external\n> >tooling), but they all involve extra indirection. Having first-class support within Git\n> >for this use case would make it much simpler and more consistent.\n> >\n> >Thanks\n> >\n> >Thank you for your work maintaining and evolving Git! I would greatly appreciate\n> >any feedback on whether this idea has been considered before, and if there are\n> >technical reasons it may not fit Git’s model.\n>\n> I have been thinking about a current use case for this RFE. Consider\n> GNU/Configure-based projects where we have config.guess and config.sub in the\n> repository root. These two files are independent of the project itself and truly\n> should be shared and managed from a single authoritative source. It can be a\n> real delay/pain to wait for the project to manually update these two files\n> from an upstream to get platform support for their project.\n>\n> In order to support something like this, we might need a submodule concept\n> That supports something like a link upwards. Or this might be something\n> That could be part of the sparse-checkout infrastructure. I'm not sure, but I\n> Do think there is merit to this. It could also apply to organisations that have\n> cross-application root certificates that need to be in the same directory\n> as the application root.\n>\n> Just my musings.\n> --Randall\n>\n"},{"id":"527598","messageId":"8C362D63-3EF1-4042-A825-7DAFA9A51B22@gmail.com","threadId":"64213","inReplyTo":"03d601dc3166$0f302170$2d906450$@nexbridge.com","subject":"Re: [Feature Request] Support for sharing root-level files across repositories","fromName":"Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2025-09-29T21:17:27Z","receivedAt":"2025-09-29T21:17:39Z","isPatch":false,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"\n> Le 29 sept. 2025 à 13:25, rsbecker@nexbridge.com a écrit :\n> \n> ﻿On September 26, 2025 4:33 AM, George Ogden wrote:\n>> Hello Git developers,\n>> \n>> Firstly, apologies if this has already been discussed or if there is a way to solve this\n>> problem that I am not aware of.\n>> \n>> Motivation\n>> \n>> Git submodules are very useful for sharing directories between repositories.\n>> However, in some workflows, there is a need to share a single file that must live in\n>> the repository root.\n>> \n>> A concrete example is .pre-commit-config.yaml. I maintain a standard template\n>> across many repositories. When I add a new hook or update a version, I have to\n>> manually update the file in each repository. I could use a submodule for this, but\n>> submodules always appear in a subdirectory — not at the root where tools expect\n>> this file.\n>> \n>> The same issue arises with other configuration files that need to reside at the top\n>> level of a project (linters, CI configs, licenses, etc.).\n>> \n>> Proposal\n>> \n>> It would be helpful if Git provided a way to share a file across repositories so that it\n>> appears at the root of the working tree, without requiring a separate build step,\n>> symlink, or copy operation.\n>> \n>> I understand there are alternative approaches (subtrees, packages, external\n>> tooling), but they all involve extra indirection. Having first-class support within Git\n>> for this use case would make it much simpler and more consistent.\n>> \n>> Thanks\n>> \n>> Thank you for your work maintaining and evolving Git! I would greatly appreciate\n>> any feedback on whether this idea has been considered before, and if there are\n>> technical reasons it may not fit Git’s model.\n> \n> I have been thinking about a current use case for this RFE. Consider\n> GNU/Configure-based projects where we have config.guess and config.sub in the\n> repository root. These two files are independent of the project itself and truly\n> should be shared and managed from a single authoritative source. It can be a\n> real delay/pain to wait for the project to manually update these two files\n> from an upstream to get platform support for their project.\n> \n> In order to support something like this, we might need a submodule concept\n> That supports something like a link upwards. Or this might be something\n> That could be part of the sparse-checkout infrastructure. I'm not sure, but I\n> Do think there is merit to this. It could also apply to organisations that have\n> cross-application root certificates that need to be in the same directory\n> as the application root.\n\nSparse-checkout made me think of some kind of “repository overlay”: as long as there are no conflicts (or perhaps for later versions, conflicts are resolved by higher-layers-win), each layer (i.e., repository) knows only about its own files.\n\nAdding untracked files would need some work to choose a layer. "}]}