<?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 for beginners]]></title><description><![CDATA[Git for beginners]]></description><link>https://git-basics-essentials.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 01 Sep 2026 18:31:49 GMT</lastBuildDate><atom:link href="https://git-basics-essentials.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Git for Beginners: Basics and Essential Commands]]></title><description><![CDATA[Most beginners learn Git like this:

Copy some commands

Paste them in terminal

Hope nothing breaks


That works… until it doesn’t.
This blog is about understanding Git just enough so you can use it confidently without memorizing random commands.
Wh...]]></description><link>https://git-basics-essentials.hashnode.dev/git-for-beginners-basics-and-essential-commands</link><guid isPermaLink="true">https://git-basics-essentials.hashnode.dev/git-for-beginners-basics-and-essential-commands</guid><category><![CDATA[#git#github#Chai]]></category><dc:creator><![CDATA[Navneet Mishra]]></dc:creator><pubDate>Sat, 31 Jan 2026 10:32:07 GMT</pubDate><content:encoded><![CDATA[<p>Most beginners learn Git like this:</p>
<ul>
<li><p>Copy some commands</p>
</li>
<li><p>Paste them in terminal</p>
</li>
<li><p>Hope nothing breaks</p>
</li>
</ul>
<p>That works… until it doesn’t.</p>
<p>This blog is about <strong>understanding Git just enough</strong> so you can use it confidently without memorizing random commands.</p>
<h2 id="heading-what-is-git-in-simple-terms">What Is Git (In Simple Terms)</h2>
<p>Git is a <strong>version control system</strong>.</p>
<p>That means:</p>
<ul>
<li><p>It keeps track of changes in your project</p>
</li>
<li><p>It remembers past versions</p>
</li>
<li><p>It lets you go back when something breaks</p>
</li>
</ul>
<p>Think of Git as a <strong>time machine for your code</strong>.</p>
<p>You write code → save checkpoints → experiment freely → undo if needed.</p>
<h2 id="heading-why-git-is-used-the-real-reasons">Why Git Is Used (The Real Reasons)</h2>
<p>Git exists because real projects have problems like:</p>
<ul>
<li><p>“This worked yesterday, now it’s broken”</p>
</li>
<li><p>“Which change caused this bug?”</p>
</li>
<li><p>“I want to try something risky without fear”</p>
</li>
<li><p>“Multiple people working on the same code”</p>
</li>
</ul>
<p>Git solves this by:</p>
<ul>
<li><p>Keeping history</p>
</li>
<li><p>Tracking changes</p>
</li>
<li><p>Making experiments safe</p>
</li>
<li><p>Enabling collaboration</p>
</li>
</ul>
<p>Without Git, development is fragile.<br />With Git, mistakes become cheap.</p>
<h2 id="heading-core-git-concepts-no-jargon-overload">Core Git Concepts (No Jargon Overload)</h2>
<p>Before commands, you need the <strong>language</strong>.</p>
<h3 id="heading-repository-repo">Repository (Repo)</h3>
<p>A repository is just:</p>
<p><strong>A project that Git is tracking</strong></p>
<p>When you initialize Git in a folder, that folder becomes a repository.</p>
<h3 id="heading-commit">Commit</h3>
<p>A commit is:</p>
<p><strong>A saved snapshot of your project at a point in time</strong></p>
<p>Each commit has:</p>
<ul>
<li><p>What the project looked like</p>
</li>
<li><p>Who saved it</p>
</li>
<li><p>When it was saved</p>
</li>
<li><p>A message explaining why</p>
</li>
</ul>
<p>Think:- Commit = checkpoint</p>
<h3 id="heading-branch">Branch</h3>
<p>A branch is:</p>
<p><strong><em>An independent line of development</em></strong></p>
<p>You can:</p>
<ul>
<li><p>Try new features</p>
</li>
<li><p>Experiment safely</p>
</li>
<li><p>Not affect the main code</p>
</li>
</ul>
<p>Beginner takeaway:</p>
<p><strong><em>Branches let you explore without breaking things</em></strong></p>
<h3 id="heading-head">HEAD</h3>
<p>HEAD simply means:</p>
<p><strong><em>Where you are right now in Git history</em></strong></p>
<p>It points to:</p>
<ul>
<li><p>The current commit</p>
</li>
<li><p>On the current branch</p>
</li>
</ul>
<p>That’s it. No mystery.</p>
<hr />
<h2 id="heading-essential-git-commands-the-ones-you-actually-use">Essential Git Commands (The Ones You Actually Use)</h2>
<p>You don’t need 50 commands.<br />You need <strong>a small set used repeatedly</strong>.</p>
<h3 id="heading-git-init-start-git-tracking"><code>git init</code> — Start Git Tracking</h3>
<pre><code class="lang-plaintext">git init
</code></pre>
<p>What it means:</p>
<p><strong>“Start tracking this folder with Git”</strong></p>
<p>This creates a hidden <code>.git</code> folder where Git stores history.</p>
<h3 id="heading-git-status-know-whats-going-on"><code>git status</code> — Know What’s Going On</h3>
<pre><code class="lang-plaintext">git status
</code></pre>
<p>This is your <strong>most important command</strong>.</p>
<p>It tells you:</p>
<ul>
<li><p>What files changed</p>
</li>
<li><p>What’s staged</p>
</li>
<li><p>What’s not committed yet</p>
</li>
</ul>
<p>Run this often. Seriously.</p>
<hr />
<h3 id="heading-git-add-select-what-to-save"><code>git add</code> — Select What to Save</h3>
<pre><code class="lang-plaintext">git add file.txt
</code></pre>
<p>or</p>
<pre><code class="lang-plaintext">git add .
</code></pre>
<p>This means:</p>
<p><strong>“I want Git to include these changes in the next commit”</strong></p>
<p>It does <strong>not</strong> save history yet.<br />It prepares changes.</p>
<hr />
<h3 id="heading-git-commit-save-a-snapshot"><code>git commit</code> — Save a Snapshot</h3>
<pre><code class="lang-plaintext">git commit -m "Add login feature"
</code></pre>
<p>This creates a permanent checkpoint.</p>
<p>Rule of thumb:</p>
<ul>
<li><p>One logical change = one commit</p>
</li>
<li><p>Message explains <strong>why</strong>, not just what</p>
</li>
</ul>
<h3 id="heading-git-log-view-history"><code>git log</code> — View History</h3>
<pre><code class="lang-plaintext">git log
</code></pre>
<p>This shows:</p>
<ul>
<li><p>Past commits</p>
</li>
<li><p>Who made them</p>
</li>
<li><p>When</p>
</li>
<li><p>Messages</p>
</li>
</ul>
<p>This is how you travel back in time.</p>
<h2 id="heading-a-basic-git-workflow-from-scratch">A Basic Git Workflow (From Scratch)</h2>
<p>Let’s walk through a <strong>realistic beginner workflow</strong>.</p>
<h3 id="heading-step-1-create-a-project">Step 1: Create a project</h3>
<pre><code class="lang-plaintext">mkdir my-project
cd my-project
</code></pre>
<h3 id="heading-step-2-initialize-git">Step 2: Initialize Git</h3>
<pre><code class="lang-plaintext">git init
</code></pre>
<p>Now Git is watching this folder.</p>
<h3 id="heading-step-3-create-a-file">Step 3: Create a file</h3>
<pre><code class="lang-plaintext">touch index.html
</code></pre>
<p>Edit it. Add some content.</p>
<h3 id="heading-step-4-check-status">Step 4: Check status</h3>
<pre><code class="lang-plaintext">git status
</code></pre>
<p>Git tells you:</p>
<p><strong>“I see new changes, but I’m not tracking them yet”</strong></p>
<h3 id="heading-step-5-add-changes">Step 5: Add changes</h3>
<pre><code class="lang-plaintext">git add .
</code></pre>
<p>Now Git knows what you want to save.</p>
<h3 id="heading-step-6-commit">Step 6: Commit</h3>
<pre><code class="lang-plaintext">git commit -m "Initial project setup"
</code></pre>
<p>Boom. First checkpoint created.</p>
<h3 id="heading-step-7-repeat">Step 7: Repeat</h3>
<p>Change → status → add → commit<br />That’s 80% of Git usage.</p>
<h2 id="heading-the-mental-model-to-remember">The Mental Model to Remember</h2>
<p>Don’t think:</p>
<p><strong>“Which Git command should I run?”</strong></p>
<p>Think:</p>
<p><strong>“What do I want Git to remember right now?”</strong></p>
<p>Git is about:</p>
<ul>
<li><p>History</p>
</li>
<li><p>States</p>
</li>
<li><p>Safety</p>
</li>
</ul>
<p>Not commands.</p>
<hr />
<h2 id="heading-common-beginner-mistakes-quick-warnings">Common Beginner Mistakes (Quick Warnings)</h2>
<ul>
<li><p>Skipping <code>git status</code></p>
</li>
<li><p>Making huge commits with many unrelated changes</p>
</li>
<li><p>Writing useless commit messages like “update”</p>
</li>
<li><p>Being afraid to commit often</p>
</li>
</ul>
<p>Commit early. Commit often.<br />Git is built for that.</p>
<hr />
<h2 id="heading-final-thought">Final Thought</h2>
<p>Git is not hard.<br />It’s just <strong>unfamiliar at first</strong>.</p>
<p>Once the basics click:</p>
<ul>
<li><p>You stop fearing mistakes</p>
</li>
<li><p>You experiment more</p>
</li>
<li><p>You become a better developer</p>
</li>
</ul>
<p>Learn Git early.<br />Your future self will thank you.</p>
]]></content:encoded></item></channel></rss>