How do I .gitignore and delete an already committed file without affecting other working copies?
You can tell git to completely ignore changes to tracked files without having to remove them. Use this command:
git update-index --assume-unchanged [FILENAME]
Then if you want to track the file later:
git update-index --no-assume-unchanged [FILENAME]
Could you rather keep settings.py deleted permanently (both locally and on remote), and:
- version a
setting_remote
file for the remote side - version a
setting_local
file for the local side (ie with local specific settings) - add a filter driver able to rebuild the right
settings.py
file on checkout.
That way, settings.py
is kept "private" (non-versioned). But the specific values for each environment are versioned, each set in its own file, without any merging issue.