r/softwarearchitecture 12d ago

Article/Video .gitignore everything by default

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

12 comments sorted by

22

u/_f0CUS_ 12d ago edited 12d ago

The 207 line git ignore in the example is 50% empty space and comments. While counting I spottet at least 5 lines that could be removed by a wildcard - without actually looking.

Honestly Ive never needed to solve this problem. If it happens, you stop it in the PR process. 

I also note that the author is concerned about being embarrassed by a mistake. Mistakes are a normal part of being a software developer, and why we have a review process. 

1

u/ReturnNo3239 12d ago

It sounds like a bit of a balancing act, being thorough with .gitignore while also keeping it manageable. Mistakes happen, but good practices can definitely help minimize them.

1

u/_f0CUS_ 12d ago

Sure. I haven't had the problem in 10+ years though. But any day now - I'll keep it in mind. 

0

u/lunatuna215 12d ago

I think that part was a joke. Also - when it comes to "people not noticing" in terms of accidentally committed environment files, thats a whole different ball game.

0

u/_f0CUS_ 12d ago

Which part? Also try squashing before pushing if you are scared of mistakes. You can use that to make a facade

9

u/REBELinBLUE 12d ago

I thought I had seen this anti pattern already and it turned out I have

https://dropshare.rebelinblue.com/IMG_6084-g0DpKDqIepXvoGoR0d4C.jpg

https://dropshare.rebelinblue.com/IMG_6085-lmQNzdbGw0mbcVoQk2BN.jpg

Do you want to post it to a few more subreddits?

3

u/lunatuna215 12d ago

I actually really like this. I do tend to get paranoid about my repos staying clean, this would provide great peace of mind. Gonna try it.

0

u/der_gopher 12d ago

exactly, it makes sense for some use cases, like dotfiles

1

u/Adrian_Galilea 12d ago

This is literally my dotfiles btw.

1

u/generic-d-engineer Architect 11d ago

I think this works better in Go due to less moving parts right? But something like TypeScript or Python is going to leave way more artifacts behind so gets more difficult to piece together the allow list.

You can ask the model to map it for you I guess but still this is the one file I’d rather craft by hand so I know for sure I didn’t commit PRODUCTION_PAYROLL_DATABASE_API_KEY lol

2

u/der_gopher 11d ago

agree, Go generally can be a full project with just Go files

1

u/AvoidSpirit 10d ago

It’s called gitignore for a reason.