<?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[Git rm command practice]]></title><description><![CDATA[Git rm command practice]]></description><link>https://git-rm-command-practice.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 01 Sep 2026 08:43:45 GMT</lastBuildDate><atom:link href="https://git-rm-command-practice.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Understanding git rm by Practicing It in the Terminal (Hands-On Git Learning)]]></title><description><![CDATA[Introduction
While learning Git as part of my DevOps preparation, I realized that understanding file removal in Git is more than just deleting files using rm.So I practiced the git rm command in the terminal to clearly understand how Git handles trac...]]></description><link>https://git-rm-command-practice.hashnode.dev/understanding-git-rm-by-practicing-it-in-the-terminal-hands-on-git-learning</link><guid isPermaLink="true">https://git-rm-command-practice.hashnode.dev/understanding-git-rm-by-practicing-it-in-the-terminal-hands-on-git-learning</guid><category><![CDATA[git learning]]></category><dc:creator><![CDATA[Rakesh  Kumar M]]></dc:creator><pubDate>Mon, 16 Feb 2026 01:41:51 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>While learning Git as part of my DevOps preparation, I realized that understanding file removal in Git is more than just deleting files using <code>rm</code>.<br />So I practiced the <code>git rm</code> command in the terminal to clearly understand how Git handles tracked and untracked files.</p>
<p>This blog shares what I practiced and what I learned.</p>
<p>I started with a clean Git repository containing three tracked files:</p>
<pre><code class="lang-plaintext">git status
git ls-files
ls
</code></pre>
<p>Output showed:</p>
<ul>
<li><p><code>file1</code>, <code>file2</code>, and <code>file3</code> were tracked by Git</p>
</li>
<li><p>All three files existed in the working directory</p>
</li>
</ul>
<h2 id="heading-removing-a-file-only-from-git-tracking">Removing a File Only from Git Tracking</h2>
<p>I first used the following command:</p>
<pre><code class="lang-plaintext">git rm --cached file1
</code></pre>
<h3 id="heading-what-happened">What happened:</h3>
<ul>
<li><p><code>file1</code> was removed from <strong>Git tracking</strong></p>
</li>
<li><p>The file still existed in the local directory</p>
</li>
</ul>
<p>Verification:</p>
<pre><code class="lang-plaintext">git ls-files
ls
</code></pre>
<p>This helped me understand that <code>git rm --cached</code> is useful when we want Git to stop tracking a file without deleting it locally (for example, config files or secrets).</p>
<h2 id="heading-removing-a-file-completely">Removing a File Completely</h2>
<p>Next, I used:</p>
<pre><code class="lang-plaintext">git rm file2
</code></pre>
<h3 id="heading-result">Result:</h3>
<ul>
<li><p><code>file2</code> was removed from Git</p>
</li>
<li><p><code>file2</code> was deleted from the working directory</p>
</li>
</ul>
<p>Verification:</p>
<pre><code class="lang-plaintext">git ls-files
ls
</code></pre>
<p>Only <code>file3</code> remained tracked and present locally.</p>
<hr />
<h2 id="heading-key-learnings">Key Learnings</h2>
<ul>
<li><p><code>git rm --cached</code> removes a file only from Git tracking</p>
</li>
<li><p><code>git rm</code> removes a file from Git tracking <strong>and</strong> deletes it locally</p>
</li>
<li><p>Git commands work only on <strong>tracked files</strong></p>
</li>
<li><p><code>git ls-files</code> is useful to verify which files Git is tracking</p>
</li>
</ul>
<hr />
<h2 id="heading-why-this-matters-in-real-projects">Why This Matters in Real Projects</h2>
<p>In real-world projects, <code>git rm --cached</code> is commonly used to:</p>
<ul>
<li><p>Remove accidentally committed files</p>
</li>
<li><p>Stop tracking configuration or secret files</p>
</li>
<li><p>Prepare files to be added to <code>.gitignore</code></p>
</li>
</ul>
<p>Understanding this prevents accidental data loss.</p>
<hr />
<h2 id="heading-conclusion">✅ Conclusion</h2>
<p>Practicing Git commands directly in the terminal helped me understand concepts much better than reading documentation alone.<br />This hands-on approach is helping me build strong Git fundamentals as I prepare for a DevOps role.</p>
<p>Next, I plan to practice <code>.gitignore</code> and Git branching.</p>
<hr />
<h2 id="heading-recommended-hashnode-tags">🏷️ Recommended Hashnode Tags</h2>
<p>#git #devops #learning #linux #beginners</p>
]]></content:encoded></item></channel></rss>