<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: petermf</title>
    <description>The latest articles on Forem by petermf (@petermf).</description>
    <link>https://forem.com/petermf</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F540472%2F0a7b5b2d-42c2-4512-a42f-18df2e57652f.png</url>
      <title>Forem: petermf</title>
      <link>https://forem.com/petermf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/petermf"/>
    <language>en</language>
    <item>
      <title>How to Ignore Local Files in Git Without Modifying .gitignore</title>
      <dc:creator>petermf</dc:creator>
      <pubDate>Tue, 17 Jun 2025 09:00:00 +0000</pubDate>
      <link>https://forem.com/petermf/how-to-ignore-local-files-in-git-without-modifying-gitignore-2ipi</link>
      <guid>https://forem.com/petermf/how-to-ignore-local-files-in-git-without-modifying-gitignore-2ipi</guid>
      <description>&lt;p&gt;As developers, we often create temporary files or debug utilities during development.&lt;/p&gt;

&lt;p&gt;But what if you don’t want these debug files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;to show up in &lt;code&gt;git status&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;or accidentally be committed&lt;/li&gt;
&lt;li&gt;yet you don’t want to edit &lt;code&gt;.gitignore&lt;/code&gt; — especially in a shared codebase&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Use &lt;code&gt;.git/info/exclude&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Git has a &lt;strong&gt;local-only ignore file&lt;/strong&gt;, specific to your repo clone located at &lt;code&gt;.git/info/exclude&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Anything you add there behaves just like &lt;code&gt;.gitignore&lt;/code&gt;, but:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It’s &lt;strong&gt;not version-controlled&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;It &lt;strong&gt;won’t affect your teammates&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;It’s &lt;strong&gt;perfect for one-off debug or temp files&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why I Use This
&lt;/h2&gt;

&lt;p&gt;I had a helper function called &lt;code&gt;useRenderCount()&lt;/code&gt; to count component renders while debugging a React app.&lt;/p&gt;

&lt;p&gt;I didn’t want to commit it by accident or to pollute the shared &lt;code&gt;.gitignore&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Adding it to &lt;code&gt;.git/info/exclude&lt;/code&gt; let me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;keep the file locally&lt;/li&gt;
&lt;li&gt;use it freely&lt;/li&gt;
&lt;li&gt;never worry about it ending up in Git&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>programming</category>
      <category>git</category>
      <category>softwaredevelopment</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
