<?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: Sarvesh Mohite</title>
    <description>The latest articles on DEV Community by Sarvesh Mohite (@sarvesh_mohite).</description>
    <link>https://dev.to/sarvesh_mohite</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%2F2328897%2F9069977a-d8e5-41da-98d8-593218f5fa79.jpg</url>
      <title>DEV Community: Sarvesh Mohite</title>
      <link>https://dev.to/sarvesh_mohite</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sarvesh_mohite"/>
    <language>en</language>
    <item>
      <title>Git Isn't Magic-Here's What's Actually Happening Under the Hood</title>
      <dc:creator>Sarvesh Mohite</dc:creator>
      <pubDate>Thu, 26 Mar 2026 05:43:22 +0000</pubDate>
      <link>https://dev.to/sarvesh_mohite/git-isnt-magic-heres-whats-actually-happening-under-the-hood-5cdi</link>
      <guid>https://dev.to/sarvesh_mohite/git-isnt-magic-heres-whats-actually-happening-under-the-hood-5cdi</guid>
      <description>&lt;h2&gt;
  
  
  Git Finally Clicked When I Understood This
&lt;/h2&gt;

&lt;p&gt;You probably use Git every day, like I do.&lt;/p&gt;

&lt;p&gt;You run &lt;code&gt;git add&lt;/code&gt;, &lt;code&gt;git commit&lt;/code&gt;, &lt;code&gt;git push&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
Most of the time, it works.&lt;/p&gt;

&lt;p&gt;But the moment something goes wrong—merge conflicts, weird states, lost commits—Git suddenly feels… unpredictable.&lt;/p&gt;

&lt;p&gt;That’s not because Git is complicated.&lt;br&gt;&lt;br&gt;
It’s because we usually learn Git as a set of commands, not as a system.&lt;/p&gt;


&lt;h2&gt;
  
  
  The Shift That Makes Git Click
&lt;/h2&gt;

&lt;p&gt;Here’s the idea that changes everything:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Git is just a content-addressable database.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In simple terms, it stores data, gives it a hash, and links things together.&lt;/p&gt;

&lt;p&gt;Once you see this, Git stops feeling like magic.&lt;/p&gt;


&lt;h2&gt;
  
  
  The 3 Building Blocks of Git
&lt;/h2&gt;

&lt;p&gt;Everything in Git is built from just three object types.&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Blob — File Content
&lt;/h3&gt;

&lt;p&gt;A blob is just the contents of a file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No filename
&lt;/li&gt;
&lt;li&gt;No metadata
&lt;/li&gt;
&lt;li&gt;Just raw data
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If two files have the same content, Git stores them only once.&lt;/p&gt;


&lt;h3&gt;
  
  
  2. Tree — Folder Structure
&lt;/h3&gt;

&lt;p&gt;A tree represents a directory.&lt;/p&gt;

&lt;p&gt;It maps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;filenames → blobs
&lt;/li&gt;
&lt;li&gt;directories → other trees
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think of it as a snapshot of your project structure.&lt;/p&gt;


&lt;h3&gt;
  
  
  3. Commit — A Snapshot with Context
&lt;/h3&gt;

&lt;p&gt;A commit points to a tree and adds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;author
&lt;/li&gt;
&lt;li&gt;message
&lt;/li&gt;
&lt;li&gt;parent commit
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So a commit is not “changes”—it’s a snapshot of your project at a moment in time.&lt;/p&gt;


&lt;h2&gt;
  
  
  Let’s Look Under the Hood
&lt;/h2&gt;

&lt;p&gt;Git has a set of low-level commands called &lt;em&gt;plumbing commands&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;These are what the high-level commands actually use internally.&lt;/p&gt;

&lt;p&gt;You don’t need all of them—just a few will change how you think.&lt;/p&gt;


&lt;h3&gt;
  
  
  1. &lt;code&gt;git hash-object&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This command takes content, hashes it, and stores 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;echo&lt;/span&gt; &lt;span class="s2"&gt;"hello"&lt;/span&gt; | git hash-object &lt;span class="nt"&gt;-w&lt;/span&gt; &lt;span class="nt"&gt;--stdin&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It returns a hash like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;b6fc4c620b67d95f953a5c1c1230aaab5db5a1b0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That hash is the identity of the content.&lt;/p&gt;

&lt;p&gt;Why this matters:&lt;br&gt;
Git tracks content, not files.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;git cat-file&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This lets you inspect anything inside Git.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git cat-file &lt;span class="nt"&gt;-p&lt;/span&gt; &amp;lt;&lt;span class="nb"&gt;hash&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use it to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;read commits&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;view file contents&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;inspect trees&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why this matters:&lt;br&gt;
Nothing in Git is hidden—you can inspect everything.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;git write-tree&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This takes your staging area and turns it into a tree object.&lt;/p&gt;

&lt;p&gt;git write-tree&lt;/p&gt;

&lt;p&gt;Why this matters:&lt;br&gt;
The staging area is literally a blueprint for your next commit.&lt;/p&gt;

&lt;p&gt;What git commit Actually Does&lt;/p&gt;

&lt;p&gt;When you run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"message"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Git is really doing this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Save staged files as a tree&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a commit pointing to that tree&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Move the branch to the new commit&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s it.&lt;/p&gt;

&lt;p&gt;No magic—just structured data.&lt;/p&gt;

&lt;p&gt;Final Thought&lt;/p&gt;

&lt;p&gt;Once you understand this, Git stops being unpredictable.&lt;/p&gt;

&lt;p&gt;It becomes a system you can reason about.&lt;/p&gt;

&lt;p&gt;If you found this useful, I’d love to hear your thoughts or feedback.&lt;/p&gt;

&lt;p&gt;Email: &lt;a href="mailto:sarveshmohite2005@gmail.com"&gt;sarveshmohite2005@gmail.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;LinkedIn: &lt;a href="https://www.linkedin.com/in/sarvesh-mohite-0a6344251/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/sarvesh-mohite-0a6344251/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Twitter/X: &lt;a href="https://x.com/SarveshMohite2" rel="noopener noreferrer"&gt;https://x.com/SarveshMohite2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Substack: &lt;a href="https://sarveshdeepakmohite.substack.com/" rel="noopener noreferrer"&gt;https://sarveshdeepakmohite.substack.com/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>git</category>
      <category>learning</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
