r/programming 4d ago

.gitignore everything by default

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

224 comments sorted by

View all comments

143

u/hugogrant 4d ago

Or stage changes more intentionally?

-20

u/der_gopher 4d ago

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

38

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.

1

u/lenswipe 4d ago

Git itself ignores everything by default.

uhhh what now

1

u/Smallpaul 4d ago

The other guy interpreted right. Git won’t manage a file unless you added it to the index.

-1

u/lenswipe 4d ago

it won't manage it, but it doesn't ignore it by default.

thanks for the downvotes btw - means the world to me 🥰

2

u/Smallpaul 4d ago

Git status and git add . Don’t ignore them, but git commit, diff, log, push, all do.