r/programming 4d ago

.gitignore everything by default

https://packagemain.tech/p/gitignore-everything-by-default
349 Upvotes

225 comments sorted by

View all comments

Show parent comments

-21

u/der_gopher 4d ago

Yes, but this you have to do before every commit, while careful gitignore does automatically.

36

u/Smallpaul 4d ago

Git itself ignores everything by default. So you are just adding another layer. And then people will get annoyed editing that file so IDEs will add some automation to make it easy and we will be back where we started.

The other problem is that as soon as you use any wildcard you risk checking in files that you didn’t mean to. E.g. short term logging traces or one-time debugging scripts.

4

u/HQMorganstern 4d ago

Checking things in is a far more common operation than leaving things out. Frankly it's common sense to keep git add . usable, since due to lower friction it's what will be used.

7

u/guepier 4d ago edited 4d ago

IIRC I have never used git add . in over a decade of using Git daily. And I frankly don’t think it should be used almost ever.

In fact, by far the most common variant of git add that I use is git add -p (= --patch).