Re: A new feature command request `cmd_ignore`
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Jan 15, 2022, 15:38 UTC
- Message-ID
- <9a7eac53-79fe-24f5-225a-d00d26e67259@kdbg.org>
- In-Reply-To
- <9a3837b4-8c67-e114-e977-f6c7b729ba45@gmail.com>
Am 15.01.22 um 11:45 schrieb Jaydeep Das:
Show 13 quoted lines
> >> I think that is a paraphrase of the suggestion to > > git rm --cached settings > echo settings >> .gitignore > >> when changes to a file 'settings' that was already tracked (and often >> contains user-specific settings) should be ignored. This misguided and >> short-sighted "solution" is repeated numerous times on Stackoverflow. >> Not something that we should encourage. > > So what should be done in this scenario? And why is it a discouraged and > misguided thing?
It is misguided because if you commit the removal of 'settings', others who pull/merge this change will either see their 'settings' be removed (when they did not change the file) or their pull/merge will fail with an error about a modified file being in the way (when they did modify it). It causes a whole lot of grief for others.
There are different ways to address this problem.
- One is to commit a 'settings.template' file that must be copied to 'settings' and is adjusted as necessary, but not `git add`ed.
- Another is to have a mechanism that can include local files that carry the user-specific settings.
- Yet another is to generate the final file from a tracked template and a local, untracked, file during the build process.
-- Hannes