4 ms·
Something I've always wanted from gitignore: a way to ignore changes to a file that is already present in the repo. So, for example, I can commit a config file
by wheybags 4y ago
Something I've always wanted from gitignore: a way to ignore changes to a file that is already present in the repo. So, for example, I can commit a config file that should contain secure credentials with the credentials redacted, and then ignore it so the credentials don't accidentally get pushed from someone's working dir.
For now what I do is ignore the config path and commit an "x.conf.example" file, but that is a bit more of a pain to use.
- coder543 4y agoI think the .conf.example approach is probably better, but the answer to your implied question is here: https://git-scm.com/docs/git-update-index https://git-scm.com/docs/git-update-index If you use --assume-unchanged on a file, then git will stop noticing changes at that point. I believe this only applies to your copy of the repo, though.
- joboyx 4y agoi'm using Intellij, so for scenarios like this I create a separate "changelist" with name "LOCAL-ONLY" and include passwords and any local config that only applies to me. That way I can clearly see that these changes don't get commited. You can also put line changes on the same file on different changelists. Changelists concept is native with P4, but not sure with git. Maybe that's why Intellij only have it coz they've implemented their own on top of git.