<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Vic-rider Land]]></title><description><![CDATA[Vic-rider Land]]></description><link>https://vic-rider.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 01:09:54 GMT</lastBuildDate><atom:link href="https://vic-rider.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[My .gitignore doesn’t work, git not ignoring my files/folders. How to fix it? How to ignore committed files/folders?]]></title><description><![CDATA[One thing you have to know is that Git only ignores the files/folders that have not been committed to the repository yet and are listed in .gitignore. So before your first commit, remember to set the files/folders you want to ignore to .gitignore and...]]></description><link>https://vic-rider.hashnode.dev/my-gitignore-doesnt-work-git-not-ignoring-my-filesfolders-how-to-fix-it-how-to-ignore-committed-filesfolders</link><guid isPermaLink="true">https://vic-rider.hashnode.dev/my-gitignore-doesnt-work-git-not-ignoring-my-filesfolders-how-to-fix-it-how-to-ignore-committed-filesfolders</guid><category><![CDATA[Git]]></category><category><![CDATA[gitignore]]></category><category><![CDATA[software development]]></category><dc:creator><![CDATA[Vincent A.S TOSSOU]]></dc:creator><pubDate>Tue, 18 Apr 2023 12:34:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1681821018684/3780bb20-55b6-4d9f-bfec-b5bfb0a4889d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>One thing you have to know is that Git only ignores the files/folders that have not been committed to the repository yet and are listed in .gitignore. So before your first commit, remember to set the files/folders you want to ignore to .gitignore and with their right path.</p>
<p><strong><em>Cause</em></strong> :</p>
<ul>
<li><p>When you don’t put the right path of your files in .gitignore list</p>
</li>
<li><p>When you don’t set your .gitignore list before your first commit. Git doesn’t ignore the files that are already committed.</p>
</li>
</ul>
<p><strong><em>Solution</em></strong> :</p>
<p>The solution is quite simple. You have to push again without the file or folder you wanted to exclude existing in your workspace.</p>
<p><em>A</em>. <strong>Remove or Backup Files/Folders</strong></p>
<p>You have to remove all the files/folders that are supposed to be ignored by git and make a commit. But to make things easy, you can back them up to replace them in their right path when the fixing is done.</p>
<p>It will make the files/folders untracked by git. After that, make sure they are properly listed in .gitignore with the right path, and they should no longer be tracked by git.</p>
<p><em>B</em>. <strong>Fixing</strong></p>
<ol>
<li><strong>Method 01:</strong> More suitable when don’t have many important commits in your repository.</li>
</ol>
<p>You have to reset to the previous commit.</p>
<ul>
<li>Run in your project <code>git log</code>.</li>
</ul>
<p><img src="https://miro.medium.com/v2/resize:fit:498/0*8AjUbwk_LSkQUaux.png" alt /></p>
<ul>
<li><p>Run <code>git reset 59c46944f9bef24453a9d9a4cba18eba8c2ed6ba</code>.</p>
</li>
<li><p>Add the files/folders you remove or backup.</p>
</li>
<li><p>Now you can re-add / re-stage your files with <code>git add -A</code> or <code>git add *</code> and you can check if your files/folders are now ignored by git with <code>git status</code>.</p>
</li>
<li><p>After that, you can make a commit with your issue fixed and git ignoring your files/folders. Run <code>git commit -m “commit with the files/folders ignored properly”</code>.</p>
</li>
</ul>
<ol>
<li><strong>Method 02 :</strong></li>
</ol>
<ul>
<li><p>Remove the files from the index (not the actual files in your project) <code>git rm -r –cached .</code>.</p>
</li>
<li><p>Add the files/folders you remove or backup.</p>
</li>
<li><p>Now you can re-add / re-stage your files with <code>git add -A</code> or <code>git add *</code> and you can check if your files/folders are now ignored by git with <code>git status</code>.</p>
</li>
<li><p>After that, you can make a commit with your issue fixed and git ignoring your files/folders. Run <code>git commit -m “commit with the files/folders ignored properly”</code>.</p>
</li>
</ul>
<p>Here is your humble servant Vincent TOSSOU (Vic-rider). I hope this article will help you solve your problem. And if you have any contributions to the content of this article, let me know in the comments.</p>
<p>Thanks.</p>
]]></content:encoded></item></channel></rss>