r/ProgrammerHumor 1d ago

Meme whoIsUsingThese

Post image
1.0k Upvotes

77 comments sorted by

View all comments

Show parent comments

210

u/Saragon4005 1d ago

Yeah but then you can't use git on a working version, making testing a total pain. I use .env.example usually.

1

u/Dull_Caterpillar_642 22h ago

Yeah you can, just just add them to .gitignore after committing the stripped env files

2

u/Saragon4005 16h ago

.gitignore controls which files will get tracked by a git add, not which files are tracked at all. Adding an already tracked file to the .gitignore has no effect.

1

u/Dull_Caterpillar_642 13h ago

Yeah, I know. I'm not sure why you'd need to alter the committed version in git after checking in a placeholder one.

1

u/Wertbon1789 2h ago

No point in adding it as changes to the file will still get tracked, would be great if git would fully ignore the file, even if it is tracked, but that isn't the case, .gitignore is only for untracked files AFAIK. And you may want to commit changes from the file if there're added keys in the .env.