<?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>DEV Community: purna</title>
    <description>The latest articles on DEV Community by purna (@purnapattela).</description>
    <link>https://dev.to/purnapattela</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F99mvlsfu5tfj9m7ku25d.png</url>
      <title>DEV Community: purna</title>
      <link>https://dev.to/purnapattela</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/purnapattela"/>
    <language>en</language>
    <item>
      <title>git status finally made sense when I stopped thinking in diffs</title>
      <dc:creator>purna</dc:creator>
      <pubDate>Thu, 29 Oct 2026 06:10:18 +0000</pubDate>
      <link>https://dev.to/purnapattela/git-status-finally-made-sense-when-i-stopped-thinking-in-diffs-4ap5</link>
      <guid>https://dev.to/purnapattela/git-status-finally-made-sense-when-i-stopped-thinking-in-diffs-4ap5</guid>
      <description>&lt;p&gt;git status finally clicked for me when I stopped thinking of it as comparing files. It compares three trees.&lt;/p&gt;

&lt;p&gt;The three trees are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Working directory — files you edit&lt;/li&gt;
&lt;li&gt;Index (staging area) — .git/index, the pre-commit manifest&lt;/li&gt;
&lt;li&gt;HEAD — the last commit on your branch&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When you run git status, Git roughly does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Index vs HEAD → "Changes to be committed"&lt;/li&gt;
&lt;li&gt;Working directory vs Index → "Changes not staged for commit"&lt;/li&gt;
&lt;li&gt;Files with no Index entry (and not ignored) → "Untracked files"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Try it once and you will remember it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;status-demo &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;status-demo
git init
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"# demo"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; README.md
git status
git add README.md
git status
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"first commit"&lt;/span&gt;
git status
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"new line"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; README.md
git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What to watch: before git add, README is untracked. After git add, Git writes a blob into .git/objects and creates .git/index. After commit, index and HEAD match, so status is clean. After you edit again, working directory and index differ, so it shows modified.&lt;/p&gt;

&lt;p&gt;Why is it so fast on huge repos? Git caches file stats (mtime, size, inode) in the index and skips re-hashing unchanged files. Only changed stats trigger a real hash check.&lt;/p&gt;

&lt;p&gt;Common confusion:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;M in first column of git status -s = staged. M in second column = unstaged. MM = both.&lt;/li&gt;
&lt;li&gt;git status is read-only. It does not fix anything.&lt;/li&gt;
&lt;li&gt;For scripts, use git status --porcelain, not the human output.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Source: Pro Git — Recording Changes: &lt;a href="https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository" rel="noopener noreferrer"&gt;https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devtools</category>
    </item>
  </channel>
</rss>
