News for hackers. Stuff that matters.
Re:Git ignores .gitignore with .gitignore in .gitignore by wheybags on Wednesday May 18, 2022 @09:54AM (#31422803)
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.

Re:Git ignores .gitignore with .gitignore in .gitignore by coder543 on Wednesday May 18, 2022 @10:00AM (#31422873)
I 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

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.

Re:Git ignores .gitignore with .gitignore in .gitignore by joboyx on Wednesday May 18, 2022 @05:15PM (#31427783)
i'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.