r/git • • 1h ago

tutorial .gitignore everything by default

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

9 comments sorted by

12

u/waterkip detached HEAD 1h ago

How about no?

1

u/The_Northern_Light 1h ago

It’s not that bad if your project just has a few folders that you reinclude, which I’ve at times done for a few different reasons, but it’s definitely not worth being dogmatic about.

6

u/wa11ar00 1h ago

I do this with .dockerignore, because there is only a small number of build and project artifacts that should be containerized.

For git however, majority of files in your project directory usually should be tracked by git. Then you exclude cache, env, etc.

For files like .DS_Store, I'd recommend adding to ~/.gitignore and setting git config --global core.excludesfile ~/.gitignore.

4

u/keesbeemsterkaas 51m ago

I think this is a solution to a problem I've never had

-6

u/unndunn 1h ago edited 48m ago

A few years ago, I would have disagreed. But in the age of agentic engineering, I feel like it makes much more sense to .gitignore everything and then have the agent manually add things. 

2

u/EarlMarshal 1h ago

Not like the fucking agent can just delete stuff from a file and some of your coworkers will enable his agent to exactly do that.

1

u/xplosm 25m ago

These idiots question the use of an IDE when their AI do everything. I’m afraid for the future of the industry…

-1

u/unndunn 52m ago

Put it this way: in the past, .gitignore everything would mean having to manually add every new file and folder, which would be a pain in the ass. But agents take that pain away since they can add whatever files they work on automatically. So there’s no longer a real reason not to .gitignore everything. 

1

u/kagato87 30m ago

The agent will only check in the files it needs to change.

Powerbi desktop loves to touch hundreds of files when running in project folder mode. It might show a meaningless change at the end of the files, and I've even seen it simply add a newline at the end. Claude only commits the files it knows it's touched and, thanks to rules we shouldn't have had to add, checking there are no passwords in them.