<?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[A Bit about Git]]></title><description><![CDATA[A Bit about Git]]></description><link>https://how-to-git.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 04:52:09 GMT</lastBuildDate><atom:link href="https://how-to-git.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Git Unlocked: The Essential Commands You Will Use Every Day]]></title><description><![CDATA[Welcome back to The Tech Tales.
In our last episode, we opened the hood to see the engine. Today, we get in the driver's seat.
When I first started coding, I was terrified of the black screen with white text. I thought if I typed the wrong command, m...]]></description><link>https://how-to-git.hashnode.dev/git-unlocked-the-essential-commands-you-will-use-every-day</link><guid isPermaLink="true">https://how-to-git.hashnode.dev/git-unlocked-the-essential-commands-you-will-use-every-day</guid><category><![CDATA[Git, GitHub, Version Control, Linux, Git Commands, GitHub Repositories, Cheat Sheet, Git Branching, Git Workflow, Collaboration, Git History, Git Commit, Git Merge, Git Rebase, Git Pull Request, Git Fork, Git Stash, Git Remote, Git Ignore, Git Hooks, GitHub Issues, GitHub Actions, GitHub Pages, GitHub Security, Git for Beginners, Advanced Git Techniques, GitHub Collaboration, Git Integration, Git Flow, Git Best Practices.]]></category><dc:creator><![CDATA[Shaikh Ubed]]></dc:creator><pubDate>Sat, 17 Jan 2026 13:11:54 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1768655345672/8f761bba-962f-490e-82fc-459d7368c177.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Welcome back to <em>The Tech Tales</em>.</p>
<p>In our last episode, we opened the hood to see the engine. Today, we get in the driver's seat.</p>
<p>When I first started coding, I was terrified of the black screen with white text. I thought if I typed the wrong command, my laptop would explode. But the truth is, you don't need to memorize the entire dictionary. You just need to know how to speak the language.</p>
<p>Today, we are going to look at the commands you will use 99% of the time—including the ones that save you when you mess up.</p>
<h3 id="heading-part-0-a-brief-history-of-anger">Part 0: A Brief History of Anger</h3>
<p>Before we type commands, you should know that Git exists because a genius got angry.</p>
<p>In 2005, the Linux kernel community (the people building the core of Linux) was using a proprietary tool called BitKeeper. But then, the company behind BitKeeper started charging for it.</p>
<p><strong>Linus Torvalds</strong>, the creator of Linux, wasn't having it. He disappeared for a weekend and essentially wrote the first version of Git in roughly two weeks.</p>
<p>He wanted a tool that was fast, distributed, and handled branches like a dream. He named it "Git," which is British slang for an "unpleasant person." (Linus has a unique sense of humor).</p>
<p>So, every time you use Git, remember: it was born out of pure developer frustration.</p>
<h3 id="heading-part-1-the-dictionary-the-concepts">Part 1: The Dictionary (The Concepts)</h3>
<p>Let's agree on what these weird words actually mean.</p>
<p><strong>1. Repository (The "Repo")</strong></p>
<ul>
<li><strong>The Real Definition:</strong> It’s just your <strong>Project Folder</strong>, but with superpowers. It’s a magical workshop where a tiny historian watches every move you make.</li>
</ul>
<p><strong>2. Commit</strong></p>
<ul>
<li><p><strong>The Real Definition:</strong> A <strong>Save Point</strong> in a video game.</p>
</li>
<li><p>You are about to fight a boss. You <strong>SAVE</strong> so you can respawn if you die. In Git, you "Commit" your code when it’s working. If you break it later, you just respawn at the last Commit.</p>
</li>
</ul>
<p><strong>3. HEAD</strong></p>
<ul>
<li><p><strong>The Real Definition:</strong> The <strong>"You Are Here"</strong> pin on a map.</p>
</li>
<li><p>It simply points to the version of the code you are currently looking at.</p>
</li>
</ul>
<hr />
<h3 id="heading-part-2-the-happy-path-workflow">Part 2: The "Happy Path" Workflow</h3>
<p>This is the cycle you will repeat thousands of times. Open your terminal, and let's go.</p>
<h4 id="heading-1-the-awakening-git-init">1. The Awakening: <code>git init</code></h4>
<p>You create a new folder. It’s just a dumb, regular folder. We need to wake it up.</p>
<p>Bash</p>
<pre><code class="lang-plaintext">git init
</code></pre>
<ul>
<li><strong>The Analogy:</strong> You just hired a security guard to stand in the corner and watch everything you do.</li>
</ul>
<h4 id="heading-2-the-gps-git-status">2. The GPS: <code>git status</code></h4>
<p>You create a file called <code>index.html</code>. You want to know what Git sees.</p>
<p>Bash</p>
<pre><code class="lang-plaintext">git status
</code></pre>
<ul>
<li><p><strong>The Analogy:</strong> Checking your GPS. It tells you exactly where you are: what’s new ("Untracked") and what’s changed ("Modified").</p>
</li>
<li><p><strong>Pro Tip:</strong> Run this 50 times a day. If you are ever confused, type <code>git status</code>.</p>
</li>
</ul>
<h4 id="heading-3-the-shopping-cart-git-add">3. The Shopping Cart: <code>git add</code></h4>
<p>Git is polite. It won't save anything unless you tell it to.</p>
<p>Bash</p>
<pre><code class="lang-plaintext">git add .
</code></pre>
<ul>
<li><strong>The Analogy:</strong> Putting items in your Amazon <strong>Shopping Cart</strong> (The Staging Area). You haven't paid yet! You are just saying, <em>"I intend to include these in the next save."</em></li>
</ul>
<h4 id="heading-4-the-purchase-git-commit">4. The Purchase: <code>git commit</code></h4>
<p>Your changes are in the cart. Time to check out.</p>
<p>Bash</p>
<pre><code class="lang-plaintext">git commit -m "Created the login button"
</code></pre>
<ul>
<li><strong>The Analogy:</strong> Hitting <strong>"Place Order."</strong> Git takes a snapshot of your cart and saves it permanently in the history books.</li>
</ul>
<h4 id="heading-5-the-time-machine-git-log">5. The Time Machine: <code>git log</code></h4>
<p>You want to see everything you’ve done so far.</p>
<p>Bash</p>
<pre><code class="lang-plaintext">git log
</code></pre>
<ul>
<li><strong>The Analogy:</strong> Your <strong>Instagram Archive</strong>. A chronological feed of every snapshot, who took it, and when.</li>
</ul>
<hr />
<h3 id="heading-part-3-the-oops-commands-how-to-undo">Part 3: The "Oops" Commands (How to Undo)</h3>
<p>We all make mistakes. You deleted the wrong file. You broke the code. Here is how to fix it.</p>
<h4 id="heading-6-the-ctrlz-for-files-git-restore">6. The "Ctrl+Z" for Files: <code>git restore</code></h4>
<p>You deleted a function in <code>script.js</code> by accident, but you haven't committed it yet.</p>
<p>Bash</p>
<pre><code class="lang-plaintext">git restore script.js
</code></pre>
<ul>
<li><strong>The Analogy:</strong> Crumpling up the piece of paper you were writing on, throwing it in the trash, and pulling out a fresh, clean sheet from the printer. It resets the file to how it looked at the last commit.</li>
</ul>
<h4 id="heading-7-the-undo-commit-soft-git-reset-soft">7. The "Undo Commit" (Soft): <code>git reset --soft</code></h4>
<p>You typed <code>git commit</code>, but you realized you forgot to add one file, or you made a typo in the message.</p>
<p>Bash</p>
<pre><code class="lang-plaintext">git reset --soft HEAD~1
</code></pre>
<ul>
<li><p><strong>The Analogy:</strong> Un-sealing the envelope.</p>
</li>
<li><p>It undoes the "Save," but <strong>keeps your changes</strong>. Your code is still there, it's just back in the "Shopping Cart" (Staging Area) so you can fix it and commit again.</p>
</li>
</ul>
<h4 id="heading-8-the-nuke-it-hard-git-reset-hard">8. The "Nuke It" (Hard): <code>git reset --hard</code></h4>
<p><strong>Warning:</strong> Use this carefully. You messed up everything. The code is broken, nothing works, and you just want to go back to how things were yesterday.</p>
<p>Bash</p>
<pre><code class="lang-plaintext">git reset --hard HEAD~1
</code></pre>
<ul>
<li><p><strong>The Analogy:</strong> Burning the house down and reloading your save game from 2 hours ago.</p>
</li>
<li><p>It destroys all changes since the last commit. They are gone forever.</p>
</li>
</ul>
<hr />
<h3 id="heading-1-the-traffic-light-flow-git-add-amp-git-commit">1. The Traffic Light Flow (<code>git add</code> &amp; <code>git commit</code>)</h3>
<p>This diagram visualizes the movement of your files from your working directory to the final repository, using a simple traffic light analogy.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768655277579/1c6254c1-42d9-4b81-be69-eb09095e8b3b.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-2-the-gamers-save-system-commits-amp-git-reset">2. The Gamer's Save System (Commits &amp; <code>git reset</code>)</h3>
<p>This diagram uses a video game analogy to explain commits as "save points." It also visually demonstrates how <code>git reset</code> allows you to go back to a previous save when things go wrong.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768655307458/8bc14234-9a49-463c-b2df-36f6c607aa63.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-3-the-you-are-here-map-the-head-pointer">3. The "You Are Here" Map (The <code>HEAD</code> Pointer)</h3>
<p>These two diagrams illustrate the concept of <code>HEAD</code>. The first shows <code>HEAD</code> pointing to the current commit. The second shows how <code>HEAD</code> automatically moves forward to point to the new commit after you run <code>git commit</code>.</p>
<p><strong>Before a new commit:</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768655324531/44973820-db92-4f25-b57d-3158029caa6b.png" alt class="image--center mx-auto" /></p>
<p><strong>After a new commit:</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768655336239/c053129a-19dc-411f-a284-dfa76bbe326a.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-summary-the-developers-loop">Summary: The Developer's Loop</h3>
<p>Master this loop, and you have mastered 90% of your daily work:</p>
<ol>
<li><p><strong>Code something.</strong></p>
</li>
<li><p><code>git status</code> (Check changes).</p>
</li>
<li><p><code>git add .</code> (Stage them).</p>
</li>
<li><p><code>git commit -m "..."</code> (Save them).</p>
</li>
<li><p><strong>Made a mistake?</strong> <code>git restore</code> or <code>git reset</code>.</p>
</li>
</ol>
]]></content:encoded></item></channel></rss>