{"thread":{"id":"64781","subject":"Idea regarding GIT","startedAt":"2026-01-12T02:53:57Z","lastAt":"2026-01-12T22:39:08Z","messageCount":3,"participants":["Krzysztof Zabłocki","Oswald Buddenhagen","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"533550","messageId":"DU0PR09MB8272C80E049596044EF581C2B181A@DU0PR09MB8272.eurprd09.prod.outlook.com","threadId":"64781","inReplyTo":null,"subject":"Idea regarding GIT","fromName":"Krzysztof Zabłocki","fromEmail":"k.zablocki@student.tudelft.nl","sentAt":"2026-01-12T02:53:49Z","receivedAt":"2026-01-12T02:53:57Z","isPatch":false,"sender":{"key":"k.zablocki@student.tudelft.nl","avatar":null},"body":"Dear all,\nI'm emailing to suggest feature for git. It can be useful for ppl working\nwith pipelines and having extensive personalized configs. I propose adding\nnew configuration file (or parameter in .gitconfig) .gittemplates. Files\nlisted in there had to be indexed before adding them to that file, otherwise\nit would work like .gitignore, but difference is if file was added git will\nnot track changes in it and won't commit them. It can be useful with .env\nfiles, using this feature their empty, template version can be committed and\nfrozen where local version can be edited. Same with configs requiring local,\nmachine specific paths. Now there is need to keep template version committed\nwith different name and proper one recreated locally and ignored which adds\nextra work each time. \nThanks for ur time, lmk ur thoughts.\n\nKind regards,\nKris\n"},{"id":"533603","messageId":"aWTVUC8WuHxePfRO@ugly.lan","threadId":"64781","inReplyTo":"DU0PR09MB8272C80E049596044EF581C2B181A@DU0PR09MB8272.eurprd09.prod.outlook.com","subject":"Re: Idea regarding GIT","fromName":"Oswald Buddenhagen","fromEmail":"oswald.buddenhagen@gmx.de","sentAt":"2026-01-12T11:04:48Z","receivedAt":"2026-01-12T11:04:50Z","isPatch":false,"sender":{"key":"oswald.buddenhagen@gmx.de","avatar":"https://avatars.githubusercontent.com/u/812380?v=4"},"body":"On Mon, Jan 12, 2026 at 02:53:49AM +0000, Krzysztof Zabłocki wrote:\n>I propose adding\n>new configuration file (or parameter in .gitconfig) .gittemplates. Files\n>listed in there had to be indexed before adding them to that file, otherwise\n>it would work like .gitignore, but difference is if file was added git will\n>not track changes in it and won't commit them.\n>\nat first sight this sounds functionally equivalent to \"precious\" ignored \nfiles, which was discussed here[1] last time.\n\n[1] https://lore.kernel.org/git/pull.1627.git.1703643931314.gitgitgadget@gmail.com/T/#u\n\n"},{"id":"533688","messageId":"aWV4BPdrR7nfRWWf@fruit.crustytoothpaste.net","threadId":"64781","inReplyTo":"DU0PR09MB8272C80E049596044EF581C2B181A@DU0PR09MB8272.eurprd09.prod.outlook.com","subject":"Re: Idea regarding GIT","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2026-01-12T22:39:00Z","receivedAt":"2026-01-12T22:39:08Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2026-01-12 at 02:53:49, Krzysztof Zabłocki wrote:\n> Dear all,\n> I'm emailing to suggest feature for git. It can be useful for ppl working\n> with pipelines and having extensive personalized configs. I propose adding\n> new configuration file (or parameter in .gitconfig) .gittemplates. Files\n> listed in there had to be indexed before adding them to that file, otherwise\n> it would work like .gitignore, but difference is if file was added git will\n> not track changes in it and won't commit them. It can be useful with .env\n> files, using this feature their empty, template version can be committed and\n> frozen where local version can be edited. Same with configs requiring local,\n> machine specific paths. Now there is need to keep template version committed\n> with different name and proper one recreated locally and ignored which adds\n> extra work each time.\n\nYeah, you're describing the FAQ entry listed at\nhttps://git-scm.com/docs/gitfaq#ignore-tracked-files.  The rationale\nthat's given is this:\n\n    The reason is that if Git needs to overwrite this file, such as\n    during a checkout, it doesn’t know whether the changes to the file\n    are precious and should be kept, or whether they are irrelevant and\n    can safely be destroyed.\n\nEven with a `precious` attribute for ignored files, presumably there is\nsome point at which you want to update the file.  For instance, maybe\nthe template contains a new, mandatory configuration setting that you\nneed for your software to work.  However, Git can't possible know when\nthat situation occurs.\n\nIn the case of your `.gittemplates` approach, you have no template file\non disk, only the filled-in file, so there's no way to actually rebuild\nthe file off the new template.  Your only choice would be to blow away\nthe file on disk and reset it.  However, with the existing approach, you\ncan simply run a script (which could even be done in a `post-checkout`\nhook if you like) to rebuild the ignored file from the template file,\nincluding whatever information you need or merging the existing data.\n\nIt also becomes very complex because Git is absolutely not designed to\nhave tracked files that are not written into the working tree, so things\nlike `git reset --hard` would have ambiguous behaviour: do you want to\nreset the file to its original state or do you want to preserve it?  If\nyou want to preserve it, how do you do a full reset of the working tree\nto its original state?\n\nAt work, we have a standard script for setting up the repository[0], so\nit's very easy for anyone to do anything necessary, like generating\nthese kinds of files or running database migrations.  And again, this\ncan be done automatically in a hook.\n\n[0] https://github.com/github/scripts-to-rule-them-all\n-- \nbrian m. carlson (they/them)\nToronto, Ontario, CA\n"}]}