<?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[Kshitij's Blogs]]></title><description><![CDATA[Kshitij's Blogs]]></description><link>https://blogs.kshitijgecs.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 11 May 2026 00:35:52 GMT</lastBuildDate><atom:link href="https://blogs.kshitijgecs.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Inside Git: How It Works and the Role of the .git Folder]]></title><description><![CDATA[Most of us use Git commands like git add, git commit and git push. We know what to type but we don’t know what actually happens inside.
You don’t know where your code history is actually stored? How git is tracking your history? Or how Git knows what...]]></description><link>https://blogs.kshitijgecs.dev/how-git-works</link><guid isPermaLink="true">https://blogs.kshitijgecs.dev/how-git-works</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[GitHub]]></category><category><![CDATA[Git]]></category><category><![CDATA[vcs]]></category><category><![CDATA[version control]]></category><dc:creator><![CDATA[Kshitij Kumar]]></dc:creator><pubDate>Tue, 27 Jan 2026 17:13:55 GMT</pubDate><content:encoded><![CDATA[<p>Most of us use Git commands like <code>git add</code>, <code>git commit</code> and <code>git push</code>. We know what to type but we don’t know what actually happens inside.</p>
<p>You don’t know where your code history is actually stored? How git is tracking your history? Or how Git knows what changed?</p>
<p>In this blog i will discuss How git works internally and Role of .git folder.</p>
<h2 id="heading-understanding-the-git-folder">Understanding the .git folder</h2>
<p>When you run <code>git init</code> in a folder have you notices nothing changes in folder Thats because Git creates a hidden folder called .git.</p>
<p>Thid folder is the brain of your project. It contains everything - history, branches, config settings and actual file contens in a compressed format.</p>
<p><strong>Try this</strong>: Go to your project terminal and run: <code>ls -a</code></p>
<p>You will see <code>.git</code>. If you delete this folder, your project forgets everything and It becomes just a normal folder again, No History, No Versions.</p>
<p>Inside <code>.git</code>, the most important sub folder is <code>objects/</code>. Here all data is stored.</p>
<h2 id="heading-git-objects">Git Objects</h2>
<p>Git stores data in a very specific way using ‘Objects’. In simple language Git is a key - value store like Disctionay or HashMap.</p>
<p>There are three main types of Objects you must know :</p>
<p><strong>A. Blob (Binay Large Object)</strong></p>
<p><strong>.</strong> This stores content of your file</p>
<p><strong>.</strong> It stores only the data, not the filename.</p>
<p><strong>.</strong> If You have two files with the exact same text, Git will store only one Blob.</p>
<p><strong>B. Tree</strong></p>
<p><strong>.</strong> This represnets Your directories.</p>
<p><strong>.</strong> A Tree object stores - List of filenames and Pointers to Blobs (files) or other Trees (sub-folders).</p>
<p><strong>.</strong> It connects the content with filename.</p>
<p><strong>C. Commits</strong></p>
<ol>
<li><p>This is the snaphsot you see in history</p>
</li>
<li><p>A Commit Object stores :</p>
<ul>
<li><p>The Tree (the state of folders at that time).</p>
</li>
<li><p>Metadata (Author, Timestamp, Message).</p>
</li>
<li><p>Parrent Commit (The previous commit hash).</p>
</li>
</ul>
</li>
</ol>
<h2 id="heading-how-git-tracks-changes-internel-flow">How Git Tracks Changes (Internel flow)</h2>
<p>When you works on a project you usually run two commands <code>git add</code> and <code>git commit</code>. Let’s see what happens internally.</p>
<p><strong>Step 1:</strong> <code>git add.</code></p>
<p>When you run this, Git takes your file content and compresses into a <strong>Blob</strong> and saves it inside .<code>git/objects</code>.</p>
<p>It then updates the Staging Area (Index) to say “ Hey, this file is ready to be commited”.</p>
<p><strong>Step 2:</strong> <code>git commit -m “message”</code></p>
<ol>
<li><p>Git creates a <strong>Tree Object</strong> representing your current folder structure.</p>
</li>
<li><p>It creates a <strong>Commit Object</strong> that points to this tree.</p>
</li>
<li><p>It links this new commit to it’s parent commit (previous commit).</p>
</li>
<li><p>It updates the <code>HEAD</code> pointer to this new commit.</p>
</li>
</ol>
<h2 id="heading-hash-codes-sha-1">Hash Codes (SHA-1)</h2>
<p>You must have seen those long strings like <code>a1b2c3d4……</code> next to your commits.</p>
<p>These are SHA-1 Hashes. Git takes the content of an Object (Blob, Tree or Commit) and genereates a unique 40-character ID.</p>
<p><strong>Integrity</strong>: Even if you change a single comma in file, Hashes changes completely.</p>
<p>This means no one can ulter the code history without breaking the chain. This makes git incredibly secure and reliable.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Git isn’t a tool for saving work, It is a beatiful system of pointers and snapshots.</p>
<ul>
<li><p>The <code>.git</code> folder is the database.</p>
</li>
<li><p><strong>Blobs</strong> holds data, <strong>Tree</strong> holds structure and <strong>Commits</strong> hold history.</p>
</li>
<li><p>Everything is secured by <strong>Hashes</strong>.</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Why Version Control Exists: The Pendrive Problem]]></title><description><![CDATA[Introduction:
Imagine Playing a video game without “Save Points”. One wrong move, and you lose hours of progress. Frustrating, right?
That used to be the reality of software development. Before the era of Version Control Systems (VCSs), we lived in t...]]></description><link>https://blogs.kshitijgecs.dev/why-version-control-exists</link><guid isPermaLink="true">https://blogs.kshitijgecs.dev/why-version-control-exists</guid><category><![CDATA[Why Version Control Exists: The Pendrive Problem]]></category><category><![CDATA[GitHub]]></category><category><![CDATA[Git]]></category><category><![CDATA[version control]]></category><dc:creator><![CDATA[Kshitij Kumar]]></dc:creator><pubDate>Fri, 16 Jan 2026 21:46:24 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction:</h2>
<p>Imagine Playing a video game without <strong>“Save Points”</strong>. One wrong move, and you lose hours of progress. Frustrating, right?</p>
<p>That used to be the reality of software development. Before the era of <strong>Version Control Systems (VCSs)</strong>, we lived in the age of <strong>“The Pendrive Problem”</strong> - manual backups, overwritten files, and zero collaboration safety.</p>
<p>Today, we take <code>git push</code> for granted, but do you know the nightmare that existed before it?</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768599833482/fd4cd929-5f8a-40c4-bab0-162d5c82b8e4.jpeg" alt class="image--center mx-auto" /></p>
<h2 id="heading-the-problem-why-the-pendrive-method-fails">The Problem: Why "The Pendrive Method" Fails 📉</h2>
<p>To understand why we need Git, let's look at a real-world scenario. Let's imagine a team of developers trying to build a project using just a pendrive or email.</p>
<h3 id="heading-scenario-1-the-overwrite-disaster-2-developers">Scenario 1: The "Overwrite" Disaster (2 Developers)</h3>
<p>Imagine <strong>Dev A</strong> and <strong>Dev B</strong> are working together.</p>
<ol>
<li><p><strong>Dev A</strong> writes the code for the <em>Login Page</em> and gives the file to <strong>Dev B</strong> via a pendrive.</p>
</li>
<li><p><strong>Dev B</strong> starts working on the file to add a <em>Signup Page</em>.</p>
</li>
<li><p><strong>The Conflict:</strong> While Dev B is working, <strong>Dev A</strong> doesn't stop. He stays on his laptop and fixes a bug in the <em>Login Page</em>.</p>
</li>
</ol>
<p><strong>Now we have a problem:</strong></p>
<ul>
<li><p><strong>Dev A</strong> has the fixed bug (but no Signup Page).</p>
</li>
<li><p><strong>Dev B</strong> has the Signup Page (but the old, buggy Login Page).</p>
</li>
</ul>
<p>When they try to combine their code, they hit a dead end. If Dev A copies Dev B's folder, <strong>Dev A's bug fix gets deleted (overwritten).</strong> There is no way to merge these "parallel universes" automatically.</p>
<h3 id="heading-scenario-2-the-chaos-multiplier-3-developers">Scenario 2: The "Chaos Multiplier" (3 Developers)</h3>
<p>If you think 2 people are hard to manage, see what happens when <strong>Dev C</strong> joins.</p>
<p><strong>Dev A</strong> is working on Login.</p>
<ol>
<li><p><strong>Dev B</strong> is working on Payment.</p>
</li>
<li><p><strong>Dev C</strong> starts working on a Search Bar.</p>
</li>
</ol>
<p>Since they are all working on separate laptops without a central server:</p>
<ul>
<li><p>Dev C asks for the code. Dev A gives him an <em>outdated</em> version that doesn't have Dev B's work.</p>
</li>
<li><p>Now we have <strong>3 separate projects</strong> running on 3 laptops.</p>
</li>
<li><p>To fix this, someone has to manually copy-paste code from 3 different sources line-by-line.</p>
</li>
</ul>
<p><strong>The Result?</strong> It becomes a spider web of confusion. Adding more developers doesn't speed up the work—it stops the work entirely because you spend all your time fixing copy-paste errors.</p>
<h3 id="heading-the-3-major-pain-points">The 3 Major Pain Points</h3>
<p>As we saw in the scenarios above, manual collaboration leads to:</p>
<ol>
<li><p><strong>Tracking Issues:</strong> You cannot track <em>who</em> changed the code. Did Dev A break the button, or was it Dev C?</p>
</li>
<li><p><strong>The "Undo" Problem:</strong> If you make a mistake and save the file, the previous working code is gone forever.</p>
</li>
<li><p><strong>No Collaboration:</strong> After a few days, the files become so different that you can't work together anymore.</p>
</li>
</ol>
<h2 id="heading-the-solution-version-control-systemsvcss">The Solution: Version Control Systems(VCSs)</h2>
<p>So, how do we stop the madness of <code>final_</code><a target="_blank" href="http://v2.zip"><code>v2.zip</code></a>? The answer is a <strong>Version Control System (VCS).</strong></p>
<p>Think of VCS as a superpower for your code. It solves every single problem we faced in the "Pendrive Era" by introducing three major concepts:</p>
<h3 id="heading-1-the-time-machine-solves-the-undo-problem">1. The Time Machine (Solves "The Undo Problem")</h3>
<p>In the old days, if you made a mistake and saved the file, the old code was gone forever.</p>
<ul>
<li><p><strong>With VCS:</strong> It takes a <strong>snapshot</strong> (called a Commit) of your entire project every time you save.</p>
</li>
<li><p><strong>The Benefit:</strong> If the current code crashes, you can travel back in time to yesterday's version with one command.</p>
</li>
</ul>
<h3 id="heading-2-parallel-universes-solves-the-overwriting-disaster">2. Parallel Universes (Solves "The Overwriting Disaster")</h3>
<p>Remember how Dev A deleted Dev B's code by accident? VCS solves this with <strong>Branches</strong>.</p>
<ul>
<li><p><strong>How it works:</strong> Imagine creating a copy of the world. Dev A works in <em>Universe A</em> (Branch A) and Dev B works in <em>Universe B</em> (Branch B).</p>
</li>
<li><p><strong>The Benefit:</strong> Both can work on the <strong>same file</strong> at the <strong>same time</strong> without disturbing each other. When they are done, the VCS intelligently merges the universes together. No more accidental overwrites!</p>
</li>
</ul>
<h3 id="heading-3-the-central-hub-solves-the-pendrive-problem">3. The Central Hub (Solves "The Pendrive Problem")</h3>
<p>Instead of passing physical pendrives or emailing zips, everyone connects to a <strong>Central Server</strong> (like GitHub).</p>
<ul>
<li><p><strong>How it works:</strong> Dev A pushes code to the Hub -&gt; Dev B pulls it from the Hub.</p>
</li>
<li><p><strong>The Benefit:</strong> Everyone is always synced with the latest version. The "Central Hub" acts as the single source of truth.</p>
</li>
</ul>
<h3 id="heading-is-git-the-only-option-examples-of-vcs">Is Git the Only Option? (Examples of VCS)</h3>
<p>While <strong>Git</strong> is the most popular tool (used by 90% of companies), "Version Control" is a concept, and there are other tools out there:</p>
<ol>
<li><p><strong>Git (The King ):</strong> The industry standard. It’s fast, free, and distributed (everyone has a full copy of the history).</p>
</li>
<li><p><strong>SVN (Subversion):</strong> An older, centralized system. Used by some legacy enterprise companies.</p>
</li>
<li><p><strong>Perforce (Helix Core):</strong> Popular in the <strong>Gaming Industry</strong> (e.g., Ubisoft) because it handles huge art and audio files better than Git.</p>
</li>
</ol>
<h2 id="heading-conclusion-ditch-the-pendrive-embrace-the-future">Conclusion: Ditch the Pendrive, embrace the Future</h2>
<p>If you are still naming your folders <code>project_final_final_</code><a target="_blank" href="http://v2.zip"><code>v2.zip</code></a>, it is time to stop.</p>
<p>The "Pendrive Era" was full of stress, overwritten code, and broken friendships. Today, we have tools like <strong>Git</strong> that handle the chaos for us. It might feel intimidating to type commands into a black terminal screen at first, but trust me—it is a superpower every developer needs.</p>
<p><strong>The takeaway is simple:</strong></p>
<ul>
<li><p><strong>Manual Backups</strong> = Risk of losing everything.</p>
</li>
<li><p><strong>Version Control</strong> = Peace of mind and easy collaboration.</p>
</li>
</ul>
<p>So, throw away that pendrive, install Git, and type your first command: <code>git init</code>. Your future self (and your teammates) will thank you.</p>
<p><strong>Happy Coding! 💻</strong></p>
]]></content:encoded></item></channel></rss>