tl;dr: How to commit a file (with default content) to a git repository once and then force git to never track its changes for any user? What is the dumb-man-checklist for achieving this?
How to achieve both of these conditions in the same time in git / GitHub:
- The file must be in remote repository (
git clone
must get it) otherwise the app won't start - Once cloned locally, no changes to the file must be tracked; ever and for everyone
Just like that:
git clone
→ anyone have the file; app works on default configuration- Some developer changes config to match its own expectations
- Repository is never polluted with local changes
Is it possible out-of-the-box, i.e. without every developer doing git update-index --assume-unchanged <file>
dozens of times after git clone
?
If yes, then what are the exact steps (from the repo owner / creator of the file perspective) to achieve this?
I've spent last two hours on trying to achieve this. But I must be doing something wrong or I don't understand something, because each attempt has failed.
So far I have tried:
--assume-unchanged
and--skip-worktree
: here, here, here, here, here or here (local changes still tracked)git rm --cached <file>
: here, here, here or here (file is removed from repo; not an option here)- Add file to .gitignore and commit this file (does not work for the file already in repo)
Also solutions with two files (the default one and the local one -- here and here) are out of the question for the scenario I am talking about.
I understand that this is a duplicate, but I worked really hard last couple of hours and can't find some definitive step-by-step list for keeping files (with default content) in repo while avoiding polluting it with any local changes done by anyone.