{"id":14066,"date":"2026-09-07T10:30:24","date_gmt":"2026-09-07T14:30:24","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=14066"},"modified":"2026-09-07T10:30:24","modified_gmt":"2026-09-07T14:30:24","slug":"make-git-ignore-everything-by-default","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=14066","title":{"rendered":"Make Git Ignore Everything By Default"},"content":{"rendered":"<p>\nAlex Pliutau over at <a href=\"https:\/\/packagemain.tech\">Package Main<\/a> has some sage advice about Git usage that hadn&rsquo;t occurred to me. The advice is simple: <a href=\"https:\/\/packagemain.tech\/p\/gitignore-everything-by-default\">ignore everything by default<\/a>. The idea is to avoid filling up your repository with junk. Things like generated files, OS generated files having nothing to do with your project, IDE configuration files,  AI slop, and even\u2014most critically\u2014secret credentials that are somehow always seeping into git repositories.\n<\/p>\n<p>\nAll that happens because you didn&rsquo;t think to add them to the <code>.gitignore<\/code> file. And it&rsquo;s an ongoing problem: new files that shouldn&rsquo;t get tracked are being created all the time. Pliutau&rsquo;s idea is simple. Flip things around by ignoring everything by default and then add the files you <i>do<\/i> want to track explicitly.\n<\/p>\n<p>\nThat turns out to be easy. You simply add <code>*<\/code> as the first line of your <code>.gitignore<\/code> file telling it to ignore everything. Then you add the exceptions to that policy on subsequent lines. See Pliutau&rsquo;s post for any example. You don&rsquo;t, of course, have to add, say, each C file by hand. A simple !*.c gets them all.\n<\/p>\n<p>\nI really like this idea. Like most great ideas, it&rsquo;s simple yet powerful. I wish it had occurred to me early on. My <code>.emacs.d<\/code> repository, in particular, is a total mess with all sorts of junk that shouldn&rsquo;t be in there. It&rsquo;s been on my list of things to clean up for years. Maybe Pliutau&rsquo;s hint will inspire me to finally do so.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Alex Pliutau over at Package Main has some sage advice about Git usage that hadn&rsquo;t occurred to me. The advice is simple: ignore everything by default. The idea is to avoid filling up your repository with junk. Things like generated &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=14066\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[23,37],"class_list":["post-14066","post","type-post","status-publish","format-standard","hentry","category-general","tag-git","tag-tech"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14066","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14066"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14066\/revisions"}],"predecessor-version":[{"id":14067,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14066\/revisions\/14067"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}