Re: Suggestion: Enhance git init with Language-Specific Templates
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 5, 2025, 22:52 UTC
- Message-ID
- <xmqq1pvbks3i.fsf@gitster.g>
- In-Reply-To
- <Z8jTjt1CQ7hp8KSP@tapette.crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 8 quoted lines
> What Git _does_ provide is a way to create a template of objects that > should be in the `.git` directory using the `--template` option. It's > possible to create a template that contains an initial commit with a > `.gitignore` file. I personally would not recommend this approach, > since it will not work gracefully with alternate ref formats or hash > algorithms, but it is an option for people who want to use it. This was > in common use for setting up the default branch name before `git init` > added the `-b` option and it's related config, so it is well tested.
I wouldn't have thrown objects in the --template directory, and I wouldn't count on things outside what the mechanism was invented for (namely, .git/hooks and possibly .git/info/ files) would forever be copied in newer versions of Git, but certainly "git init --template" mechanism sounds like a good escape hatch than mucking with Git code base to teach it myriad of languages and their dialects.
Thanks.