<?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[Tushar Kolte]]></title><description><![CDATA[Tushar Kolte]]></description><link>https://blog.tusharkolte.com</link><generator>RSS for Node</generator><lastBuildDate>Tue, 02 Jun 2026 11:31:27 GMT</lastBuildDate><atom:link href="https://blog.tusharkolte.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Git Branching for Beginners: What Are Branches & HEAD Really?]]></title><description><![CDATA[Hey, it's me again, Tushar.
I finally wrapped my head around what Git and GitHub are, the three areas (working → staging → commit), and the basic commands to actually use them.
This post is me journaling what I learned about branches, what HEAD reall...]]></description><link>https://blog.tusharkolte.com/git-branching-for-beginners-what-are-branches-and-head-really</link><guid isPermaLink="true">https://blog.tusharkolte.com/git-branching-for-beginners-what-are-branches-and-head-really</guid><category><![CDATA[Git]]></category><category><![CDATA[GitHub]]></category><dc:creator><![CDATA[Tushar Kolte]]></dc:creator><pubDate>Sun, 01 Feb 2026 09:33:28 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769938365995/622f2e3a-173f-4563-97f5-a22e69e2e509.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey, it's me again, Tushar.</p>
<p>I finally wrapped my head around what Git and GitHub are, the three areas (working → staging → commit), and the basic commands to actually use them.</p>
<p>This post is me journaling what I learned about branches, what HEAD really is, how to switch between them, and why actual companies live and breathe this stuff. I'll keep it simple, no fluff, just the parts that finally made sense to me.</p>
<h2 id="heading-branches-are-just-pointers-not-copies">Branches Are Just Pointers (Not Copies!)</h2>
<p>A branch in Git is <strong>not</strong> a full copy of your code. It's super lightweight.</p>
<p>Think of your commit history as:</p>
<ul>
<li>Commit A → Commit B → Commit C</li>
</ul>
<p>Each branch is basically a movable label (a pointer) that points to one of those commits, usually the latest one in that line of work.</p>
<p>When you create a new branch, Git doesn't duplicate all your files. It just makes a new pointer starting at the same commit your current branch is on.</p>
<p>Example:</p>
<ul>
<li><p>You have <code>main</code> pointing to Commit C.</p>
</li>
<li><p>You run <code>git branch feature-login</code></p>
</li>
<li><p>Now <code>feature-login</code> also points to Commit C.</p>
</li>
<li><p>Both branches share the same history up to C, zero extra space used.</p>
</li>
</ul>
<p>Then you start working on <code>feature-login</code>, make Commit D → now <code>feature-login</code> moves forward to D, but <code>main</code> stays at C.</p>
<p>That's it. Branches are cheap and fast because they're just 40-character pointers (the commit hash) stored in a tiny file.</p>
<h2 id="heading-what-is-head">What is HEAD?</h2>
<p>HEAD is Git's way of saying: <strong>"This is where you are right now."</strong></p>
<p>More precisely:</p>
<ul>
<li><p>HEAD is a special pointer that always points to the <strong>current commit</strong> you're working on.</p>
</li>
<li><p>Usually, HEAD points to a <strong>branch name</strong> (like <code>main</code> or <code>feature-login</code>).</p>
</li>
<li><p>When HEAD points to a branch, we say you're "on" that branch. Any new commit you make will move that branch forward.</p>
</li>
</ul>
<p>You can check where HEAD is with:</p>
<pre><code class="lang-bash">git branch          <span class="hljs-comment"># shows branches, * marks current one (where HEAD is)</span>
</code></pre>
<p>There's also something called "detached HEAD", when HEAD points directly to a commit hash instead of a branch. That happens if you checkout an old commit by hash. In detached mode, new commits don't move any branch, they're kind of floating until you create a branch there. For beginners, just avoid detached HEAD for now (stick to branch names).</p>
<h2 id="heading-switching-branches-the-commands-i-actually-use">Switching Branches (The Commands I Actually Use)</h2>
<p>Super straightforward once you get it.</p>
<ol>
<li><p>See what branches exist:</p>
<pre><code class="lang-bash"> git branch
</code></pre>
</li>
<li><p>Create and switch to a new branch in one command (most common):</p>
<pre><code class="lang-bash"> git checkout -b feature/add-dark-mode
 <span class="hljs-comment"># shorthand for:</span>
 <span class="hljs-comment"># git branch feature/add-dark-mode</span>
 <span class="hljs-comment"># git checkout feature/add-dark-mode</span>
</code></pre>
</li>
<li><p>Switch to an existing branch:</p>
<pre><code class="lang-bash"> git checkout main
 <span class="hljs-comment"># or newer :</span>
 git switch main
</code></pre>
</li>
</ol>
<p>When you switch, Git updates your working directory to match the latest commit on that branch. Any uncommitted changes might come along (or Git will stop you if there's conflict).</p>
<h2 id="heading-quick-bonus-topics-that-helped-me">Quick Bonus Topics That Helped Me</h2>
<ul>
<li><p><strong>Naming branches</strong> — Use descriptive names: <code>feature/user-auth</code>, <code>bugfix/payment-error-500</code>, <code>experiment/new-ui</code>. Prefixes help a lot.</p>
</li>
<li><p><strong>Delete branches after merge</strong> — <code>git branch -d feature-done</code> (local), and GitHub usually offers to delete remote after PR merge.</p>
</li>
<li><p><strong>git log --graph --oneline --decorate</strong> — Run this. It shows branches visually, super helpful to see where things diverged.</p>
</li>
<li><p><strong>Pull often</strong> — Before creating a new branch or switching back to main: <code>git pull</code> to stay up-to-date.</p>
</li>
</ul>
<p>Thanks for reading, Keep committing.</p>
]]></content:encoded></item><item><title><![CDATA[Starting with Version Control: Git, GitHub, How Commits Really Work, and First Commands]]></title><description><![CDATA[Introduction
This is my very first blog post.
I'm starting this space to document my learning journey as honestly and clearly as I can. I'm not pretending to be an expert, I'm just someone figuring things out, making mistakes, reading docs, watching ...]]></description><link>https://blog.tusharkolte.com/starting-with-version-control-git-github-how-commits-really-work-and-first-commands</link><guid isPermaLink="true">https://blog.tusharkolte.com/starting-with-version-control-git-github-how-commits-really-work-and-first-commands</guid><category><![CDATA[Git]]></category><category><![CDATA[GitHub]]></category><category><![CDATA[Gitcommands]]></category><dc:creator><![CDATA[Tushar Kolte]]></dc:creator><pubDate>Tue, 27 Jan 2026 09:23:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769939855190/105596e9-8f04-43cc-ad72-ec12ea2d69da.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>This is my very first blog post.</p>
<p>I'm starting this space to document my learning journey as honestly and clearly as I can. I'm not pretending to be an expert, I'm just someone figuring things out, making mistakes, reading docs, watching tutorials, and slowly getting better at building stuff.</p>
<h2 id="heading-what-is-git-what-is-github">What is Git? What is GitHub?</h2>
<h3 id="heading-git">Git</h3>
<p>Git is a <strong>version control system</strong> — basically a time machine for your code.</p>
<p>It lets you:</p>
<ul>
<li><p>Save exact snapshots of your project at any moment (called commits)</p>
</li>
<li><p>See exactly what changed between any two points in time</p>
</li>
<li><p>Go back to any previous version if something breaks</p>
</li>
<li><p>Experiment with new ideas safely (using branches) without touching your working code</p>
</li>
<li><p>Work completely offline — everything happens on your computer first</p>
</li>
</ul>
<p>Git was created by Linus Torvalds in 2005 to manage the Linux kernel. Today it's the standard tool used by almost every developer and team in the world. When you install Git, you get a command-line tool that lives on your machine. The moment you run <code>git init</code> in a folder, that folder becomes a "repository" and Git starts quietly keeping track of everything inside it.</p>
<h3 id="heading-github">GitHub</h3>
<p>GitHub is <strong>not</strong> Git.</p>
<p>GitHub is an online platform (owned by Microsoft) that takes your Git repositories and puts them in the cloud so you can:</p>
<ul>
<li><p>Back up your work automatically</p>
</li>
<li><p>Share your code with other people</p>
</li>
<li><p>Collaborate with teammates (multiple people editing the same project)</p>
</li>
<li><p>Show off your projects to the world (great for portfolios)</p>
</li>
<li><p>Use powerful features like pull requests, code reviews, issue tracking, GitHub Actions (automation), and even free website hosting</p>
</li>
</ul>
<p>You write and commit code using Git on your computer → you push those commits to GitHub → others can pull your code, make changes, and suggest improvements back to you.</p>
<h2 id="heading-what-exactly-is-a-repository">What Exactly is a Repository?</h2>
<p>A <strong>repository</strong> (repo) is a project folder + its complete version history.</p>
<p>Technically, when you run <code>git init</code>, Git creates a <code>.git</code> directory that contains:</p>
<ul>
<li><p>all committed snapshots (in compressed form inside <code>objects/</code>)</p>
</li>
<li><p>references to branches and tags (<code>refs/</code>)</p>
</li>
<li><p>configuration and index files</p>
</li>
</ul>
<p>Every commit is a full snapshot of the project at that moment (though Git stores only the differences efficiently using delta compression and pack files).</p>
<ul>
<li><p><strong>Local repo</strong> — on your computer</p>
</li>
<li><p><strong>Remote repo</strong> — usually on GitHub</p>
</li>
</ul>
<h2 id="heading-the-three-core-areas-of-git">The Three Core Areas of Git</h2>
<p>Git manages your project in three distinct states:</p>
<ol>
<li><p><strong>Working Directory</strong><br /> Your actual files — what you see and edit.<br /> Git compares them against the last commit (HEAD) to detect modifications.</p>
</li>
<li><p><strong>Staging Area</strong> (also called the index)<br /> A middle layer stored in <code>.git/index</code>.<br /> When you run <code>git add</code>, Git copies the current version of those files into the index.<br /> This lets you commit exactly what you staged — even if other files are still changed or untracked.</p>
</li>
<li><p><strong>Repository</strong> (committed history)<br /> Permanent snapshots created by <code>git commit</code>.<br /> Each commit is identified by a 40-character SHA-1 hash (e.g., <code>a1b2c3d...</code>).<br /> Commits point to a tree object (directory structure), parent commit(s), author, date, and message.</p>
</li>
</ol>
<p>Visual summary of the flow:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769505682917/64ce4373-f671-481d-a0ea-71e891c95989.jpeg" alt class="image--center mx-auto" /></p>
<h2 id="heading-basic-git-commands-the-ones-youll-use-every-day">Basic Git Commands — The Ones You’ll Use Every Day</h2>
<h3 id="heading-1-git-init">1. <code>git init</code></h3>
<p><strong>What it does</strong>: Turns a normal folder into a Git repository (repo). It creates a hidden <code>.git</code> folder that stores all the version history, branches, configuration, etc.</p>
<p><strong>When to use it</strong>: The very first time you want Git to start tracking a project.</p>
<p>After this, Git is "watching" the folder. Nothing is tracked yet, you still need to add and commit files.</p>
<p><strong>Tip</strong>: You only run <code>git init</code> once per project (unless you're starting fresh).</p>
<h3 id="heading-2-git-status">2. <code>git status</code></h3>
<p><strong>What it does</strong>: Shows you the current state of your repo. It tells you:</p>
<ul>
<li><p>Which files are modified but not staged</p>
</li>
<li><p>Which files are staged (ready to commit)</p>
</li>
<li><p>Which files are new (untracked)</p>
</li>
<li><p>Which branch you're on</p>
</li>
</ul>
<p><strong>When to use it</strong>: Literally all the time, before and after almost every command. It's your safety check.</p>
<p><strong>Tip</strong>: Run <code>git status</code> first whenever you're unsure what's going on.</p>
<h3 id="heading-3-git-add">3. <code>git add</code></h3>
<p><strong>What it does</strong>: Moves changes from your <strong>working directory</strong> to the <strong>staging area</strong> (also called the index). Staging lets you choose exactly what you want to include in the next commit.</p>
<p><strong>When to use it</strong>: After you've made changes and you're ready to prepare them for committing.</p>
<p><strong>Common ways to use it</strong>:</p>
<pre><code class="lang-bash">git add file.txt              <span class="hljs-comment"># stage one specific file</span>
git add css/style.css         <span class="hljs-comment"># stage another</span>
git add .                     <span class="hljs-comment"># stage ALL changes (new + modified + deleted)</span>
git add docs/                 <span class="hljs-comment"># stage everything in the docs folder</span>
</code></pre>
<p><strong>Important</strong>: <code>git add</code> doesn't save anything permanently — it just prepares the snapshot.</p>
<h3 id="heading-4-git-diff">4. <code>git diff</code></h3>
<p><strong>What it does</strong>: Shows the actual line-by-line differences (deltas) between versions of your files.</p>
<p><strong>Common uses</strong>:</p>
<ul>
<li><p><code>git diff</code> → unstaged changes (working directory vs staging area)</p>
</li>
<li><p><code>git diff --staged</code> (or <code>git diff --cached</code>) → staged changes (staging area vs last commit)</p>
</li>
<li><p><code>git diff HEAD</code> → all changes since last commit (staged + unstaged)</p>
</li>
</ul>
<p>Output might look like:</p>
<pre><code class="lang-diff"><span class="hljs-deletion">- Old line that was removed</span>
<span class="hljs-addition">+ New improved line added here</span>
</code></pre>
<p><strong>Tip</strong>: Use <code>git diff</code> before <code>git add</code> to double-check what you're about to stage.</p>
<h3 id="heading-5-git-commit">5. <code>git commit</code></h3>
<p><strong>What it does</strong>: Takes everything in the staging area and saves it as a permanent snapshot (a commit) in your repo's history. Each commit gets:</p>
<ul>
<li><p>A unique ID (SHA hash)</p>
</li>
<li><p>Your message</p>
</li>
<li><p>Author info</p>
</li>
<li><p>Timestamp</p>
</li>
<li><p>Pointer to parent commit(s)</p>
</li>
</ul>
<p><strong>When to use it</strong>: After staging — this is when you actually "save" your progress.</p>
<p><strong>Basic usage</strong>:</p>
<pre><code class="lang-bash">git commit -m <span class="hljs-string">"Add user login form and validation"</span>
</code></pre>
<p>(The <code>-m</code> lets you write a short message inline.)</p>
<p><strong>Good commit message tip</strong>: First line = short summary (50 chars or less), then blank line, then details if needed.</p>
<h3 id="heading-6-git-log">6. <code>git log</code></h3>
<p><strong>What it does</strong>: Shows the commit history — who changed what, when, and why.</p>
<p><strong>Useful variations</strong>:</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">log</span>                       <span class="hljs-comment"># full detailed history</span>
git <span class="hljs-built_in">log</span> --oneline             <span class="hljs-comment"># compact: one commit per line (most useful!)</span>
git <span class="hljs-built_in">log</span> --oneline --graph     <span class="hljs-comment"># shows branch merges visually</span>
git <span class="hljs-built_in">log</span> -p                    <span class="hljs-comment"># shows the diff (changes) for each commit</span>
git <span class="hljs-built_in">log</span> --author=<span class="hljs-string">"Tushar"</span>     <span class="hljs-comment"># filter by author</span>
git <span class="hljs-built_in">log</span> -3                    <span class="hljs-comment"># show only last 3 commits</span>
</code></pre>
<p>Thanks for reading my very first post. Here's to many more commits, many more lessons, and way fewer "final_v99" files.</p>
]]></content:encoded></item></channel></rss>