Re: [External] Document ability to disable template directory in git-init
- From
Han Young <hanyang.tony@bytedance.com>
- Date
- Jul 4, 2025, 02:49 UTC
- Message-ID
- <CAG1j3zEiD341X-_ZdR2puaEmZZ0ZBWSmyboyyGZaDXcDTcmAeA@mail.gmail.com>
- In-Reply-To
- <boris.20250703161436@codesynthesis.com>
On Thu, Jul 3, 2025 at 10:51 PM Boris Kolpackov <boris@codesynthesis.com> wrote:
> Looking at the code, this undocumented (AFAICS) behavior appears to > be there at least from git 2.1:
Digging through the changelog, I think the feature is added in v1.5.6.4:
"git init --template=" with blank "template" parameter linked files under root directories to .git, which was a total nonsense. Instead, it means "I do not want to use anything from the template directory".
Show 6 quoted lines
> I would like to suggest that we document this behavior so that it can > be relied upon. The motivation for omitting the default template are > repositories created by tools, such as package managers, for the sole > purpose of fetching some information from remotes. In this case all > the stuff copied from the template (such as hooks) is an unnecessary > waste of time and space.
I've seen some package managers pass "--template=" to git-clone, I'd say this is a widely used undocumented feature :P Document the behavior would help people understand the existing usages of --template=
Thanks.