.gitignore Everything by Default
Posted4 months agoActive4 months ago
pliutau.comTechstory
calmmixed
Debate
40/100
GitVersion ControlDevelopment Best Practices
Key topics
Git
Version Control
Development Best Practices
The article suggests ignoring everything by default in .gitignore and explicitly adding files, sparking a discussion on the pros and cons of this approach and alternative methods for managing git repositories.
Snapshot generated from the HN discussion
Discussion Activity
Light discussionFirst comment
5h
Peak period
4
0-12h
Avg / period
2.3
Key moments
- 01Story posted
Sep 4, 2025 at 10:09 AM EDT
4 months ago
Step 01 - 02First comment
Sep 4, 2025 at 3:39 PM EDT
5h after posting
Step 02 - 03Peak activity
4 comments in 0-12h
Hottest window of the conversation
Step 03 - 04Latest activity
Sep 11, 2025 at 3:53 PM EDT
4 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45127464Type: storyLast synced: 11/20/2025, 8:00:11 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
I just learned this recently. Intuitively, I had assumed that I could .gitignore a file and have it not show up in `git status`, even after staging it with `git add -f` and committing it this way.
Turns out: That's not how it works. Instead, the .gitignore entries simply don't count for any already tracked files.
(Yes, I know about `git update-index --assume-unchanged` but that has its own set of drawbacks…)
Once I complained about this to the community someone suggested a clever gitignore hack:
This by default ignores all files, except those that have a suffix and directories. I think this is a useful lesson - if you flip which files you ignore you can change the failure mode from "I accidentally committed a huge file into a repo" to "why isn't it working?". The latter can be pretty much be answered by good CI testing (maybe not always though).I think you're going to have to allow `app/*` which means you will be checking in some .DS_STORE files anyway.
The only sticking point is when I forget to use `git add -u .` when committing changes to files which are already being tracked.
I don't remember why I went with this over the global * ignore.