<?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 and ITS Basic Command]]></title><description><![CDATA[GIT and ITS Basic Command]]></description><link>https://git-and-its-basic-command.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 01 Sep 2026 01:40:15 GMT</lastBuildDate><atom:link href="https://git-and-its-basic-command.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How Git Works: A Deep Dive into the .git Directory]]></title><description><![CDATA[Introduction: Understanding Git Beyond Commands
Most developers learn Git by memorizing commands like git add, git commit, and git push. However, Git is much more than a command-line tool — it is a powerful content tracking system that stores snapsho...]]></description><link>https://git-and-its-basic-command.hashnode.dev/how-git-works-a-deep-dive-into-the-git-directory</link><guid isPermaLink="true">https://git-and-its-basic-command.hashnode.dev/how-git-works-a-deep-dive-into-the-git-directory</guid><category><![CDATA[GitHub]]></category><category><![CDATA[.git folder]]></category><dc:creator><![CDATA[Vishal Yadav]]></dc:creator><pubDate>Sun, 15 Feb 2026 17:18:09 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction-understanding-git-beyond-commands">Introduction: Understanding Git Beyond Commands</h2>
<p>Most developers learn Git by memorizing commands like <code>git add</code>, <code>git commit</code>, and <code>git push</code>. However, Git is much more than a command-line tool — it is a powerful content tracking system that stores snapshots of your project efficiently and securely. To truly understand Git, we must explore what happens internally, especially inside the hidden <code>.git</code> folder. Instead of memorizing commands, building a mental model of how Git works makes everything clearer and more logical.</p>
<hr />
<h2 id="heading-how-git-works-internally">How Git Works Internally</h2>
<p><img src="https://media.licdn.com/dms/image/v2/D5612AQGVL-BRQ1YBEw/article-cover_image-shrink_720_1280/article-cover_image-shrink_720_1280/0/1719414907801?e=2147483647&amp;t=QJ2wXmAZXWHkLjiWAWbilI8mdcSiKEgnzAw5Wx_wZTc&amp;v=beta" alt="https://media.licdn.com/dms/image/v2/D5612AQGVL-BRQ1YBEw/article-cover_image-shrink_720_1280/article-cover_image-shrink_720_1280/0/1719414907801?e=2147483647&amp;t=QJ2wXmAZXWHkLjiWAWbilI8mdcSiKEgnzAw5Wx_wZTc&amp;v=beta" /></p>
<p><img src="https://cdn.prod.website-files.com/5ed2ed8ea90a9c03bf1b5a18/613251677413b8c03d79ddac_upS1_fd17QlxeKZ8oc9kmkM6fcHBOqX8_YjfZpjju-zkrZ-loZjsffcDkgFwd-hBgOHTxgellTfX3BCr9KZbi-iY5FHhNydM7qWRhlr1AwtgWZRgvorWMNH7NOg9Ms9EbAjCrCao%3Ds0.png" alt="https://cdn.prod.website-files.com/5ed2ed8ea90a9c03bf1b5a18/613251677413b8c03d79ddac_upS1_fd17QlxeKZ8oc9kmkM6fcHBOqX8_YjfZpjju-zkrZ-loZjsffcDkgFwd-hBgOHTxgellTfX3BCr9KZbi-iY5FHhNydM7qWRhlr1AwtgWZRgvorWMNH7NOg9Ms9EbAjCrCao%3Ds0.png" /></p>
<p><img src="https://miro.medium.com/1%2AdiRLm1S5hkVoh5qeArND0Q.png" alt="https://miro.medium.com/1%2AdiRLm1S5hkVoh5qeArND0Q.png" /></p>
<p>4</p>
<p>Git works by storing <strong>snapshots of your project</strong>, not just the differences between files. Every time you commit, Git saves the current state of your project. It does this efficiently by storing only new or changed content while reusing existing data whenever possible. Internally, Git manages three main areas: the working directory (where you edit files), the staging area (where changes are prepared), and the repository (inside the <code>.git</code> folder). When you modify a file, it changes in your working directory. When you run <code>git add</code>, Git moves that change into the staging area. When you run <code>git commit</code>, Git permanently stores a snapshot inside the <code>.git</code> folder.</p>
<p>Git also uses a special hashing algorithm called <strong>SHA-1</strong> to generate a unique fingerprint for every piece of data it stores. If even one character changes in a file, the hash changes completely. This ensures data integrity and makes Git extremely reliable.</p>
<hr />
<h2 id="heading-understanding-the-git-folder">Understanding the <code>.git</code> Folder</h2>
<p><img src="https://humbletoolsmith.com/img/posts/a-look-inside-the-_git-folder/Git%20Folder%20Internals.png" alt="https://humbletoolsmith.com/img/posts/a-look-inside-the-_git-folder/Git%20Folder%20Internals.png" /></p>
<p><img src="https://git-scm.com/book/en/v2/images/data-model-3.png" alt="https://git-scm.com/book/en/v2/images/data-model-3.png" /></p>
<p><img src="https://media.licdn.com/dms/image/v2/D5612AQGq9qEQB2EpOw/article-cover_image-shrink_720_1280/article-cover_image-shrink_720_1280/0/1683085594035?e=2147483647&amp;t=ivAAPzrWdZOGvcxwZwTRAu552dpbE1SpkE85NAi0OXA&amp;v=beta" alt="https://media.licdn.com/dms/image/v2/D5612AQGq9qEQB2EpOw/article-cover_image-shrink_720_1280/article-cover_image-shrink_720_1280/0/1683085594035?e=2147483647&amp;t=ivAAPzrWdZOGvcxwZwTRAu552dpbE1SpkE85NAi0OXA&amp;v=beta" /></p>
<p>When you run <code>git init</code>, Git creates a hidden folder named <code>.git</code>. This folder is the heart of your repository. It contains everything Git needs to track your project history. If you delete the <code>.git</code> folder, you lose all version history because that folder stores all commits, branches, and metadata.</p>
<p>Inside the <code>.git</code> folder, Git maintains several important components. The <code>objects</code> directory stores all Git objects such as file contents and commits. The <code>refs</code> directory keeps track of branch references. The <code>HEAD</code> file points to the current branch you are working on. The <code>index</code> file represents the staging area, and the <code>config</code> file stores repository-specific settings. In simple terms, the <code>.git</code> folder acts like a private database that manages your project’s entire history.</p>
<hr />
<h2 id="heading-git-objects-blob-tree-and-commit">Git Objects: Blob, Tree, and Commit</h2>
<p><img src="https://miro.medium.com/1%2AOTYINUfVcSmrmd2U6G914Q.png" alt="https://miro.medium.com/1%2AOTYINUfVcSmrmd2U6G914Q.png" /></p>
<p><img src="https://thoughtbot-images.s3.amazonaws.com/upcase/git-course/git-base-object-model.png" alt="https://thoughtbot-images.s3.amazonaws.com/upcase/git-course/git-base-object-model.png" /></p>
<p><img src="https://shafiul.github.io/gitbook/assets/images/figure/objects-example.png" alt="https://shafiul.github.io/gitbook/assets/images/figure/objects-example.png" /></p>
<p>Git stores data in the form of objects, and there are three main types: <strong>Blob, Tree, and Commit</strong>. A blob (Binary Large Object) stores the actual content of a file. It does not store the file name — only the content. If you modify a file, Git creates a new blob with a new hash. A tree object represents the directory structure and connects file names to their corresponding blobs. It acts like a folder that organizes files. A commit object links everything together. It stores a reference to a tree, author information, commit message, timestamp, and a reference to the previous commit. This structure creates a chain of commits that forms your project history. The relationship can be understood as: Commit points to Tree, and Tree points to Blobs.</p>
<hr />
<h2 id="heading-what-happens-during-git-add-and-git-commit">What Happens During <code>git add</code> and <code>git commit</code></h2>
<p><img src="https://images.openai.com/thumbnails/url/OjM4Nnicu5meUVJSUGylr5-al1xUWVCSmqJbkpRnoJdeXJJYkpmsl5yfq5-Zm5ieWmxfaAuUsXL0S7F0Tw50NguNdDJLy44vLnZJy_HKs9AtjSwPSivNNXbRLXd0tTR38ikKc03ONQxxVCu2NTQAAASgJHw" alt="https://i.sstatic.net/F2H1Q.png" /></p>
<p><img src="https://miro.medium.com/1%2AdiRLm1S5hkVoh5qeArND0Q.png" alt="https://miro.medium.com/1%2AdiRLm1S5hkVoh5qeArND0Q.png" /></p>
<p><img src="https://images.openai.com/static-rsc-1/gOflqsX0Txgq3EUDUJ2ut2bzi6_jNWuVb2R5-szh8GI5nBi4t3jkMfOP6W5qKs6xwQOZ8-wOEH2hVeTBP4FmKrmLIKWigvqP_T81Btp91C6mqZNov6Fx55elmOVrb-4mpFHQlnXcbDddgVk15-e5MQ" alt="https://i.sstatic.net/YxFVH.png" /></p>
<p>When you run <code>git add</code>, Git reads the file from your working directory and creates a blob object from its content. It then generates a SHA-1 hash and stores the blob inside the <code>.git/objects</code> folder. The staging area (index) is updated to track this prepared snapshot. At this stage, changes are ready but not permanently recorded in history.</p>
<p>When you run <code>git commit</code>, Git creates a tree object representing the current directory structure from the staged files. It then creates a commit object that points to this tree and links it to the previous commit. Finally, Git updates the <code>HEAD</code> pointer to reference the new commit. This process creates a new snapshot in your project history.</p>
<hr />
<h2 id="heading-how-git-tracks-changes-using-hashes">How Git Tracks Changes Using Hashes</h2>
<p>Git tracks changes by generating unique hashes based on file content. Each blob, tree, and commit has its own SHA-1 hash. Because the hash is generated from the content itself, any change in content produces a completely different hash. This makes Git a <strong>content-addressable system</strong>. It ensures that data cannot be altered without detection, and it prevents corruption or duplication. Every version of your project is uniquely identified and securely stored.</p>
]]></content:encoded></item><item><title><![CDATA[Git for Beginners: Basics and Essential Commands]]></title><description><![CDATA[Inrtoduction
In today’s world of software development, writing code is only one part of the process. Managing that code efficiently is equally important. Imagine building a project for weeks and suddenly losing your progress, or working in a team whe...]]></description><link>https://git-and-its-basic-command.hashnode.dev/git-for-beginners-basics-and-essential-commands</link><guid isPermaLink="true">https://git-and-its-basic-command.hashnode.dev/git-for-beginners-basics-and-essential-commands</guid><dc:creator><![CDATA[Vishal Yadav]]></dc:creator><pubDate>Sat, 14 Feb 2026 20:14:16 GMT</pubDate><content:encoded><![CDATA[<h1 id="heading-inrtoduction">Inrtoduction</h1>
<p>In today’s world of software development, writing code is only one part of the process. Managing that code efficiently is equally important. Imagine building a project for weeks and suddenly losing your progress, or working in a team where everyone edits the same file without coordination. This is where Git becomes essential. Git is a powerful tool that helps developers track changes, manage different versions of their projects, and collaborate smoothly.</p>
<p>In this article, we will explore what Git is, why it is used, its basic concepts and terminologies, essential commands every beginner should know, and a simple developer workflow. We will also look at diagrams to better understand how Git works internally. By the end, you will have a solid foundation in Git and feel confident starting your own projects using it.</p>
<hr />
<h2 id="heading-what-is-git">What is Git?</h2>
<p>Git is a <strong>distributed version control system</strong> designed to track changes in source code. Let’s try to understad this definition. A version control system is a application or simply u can say a tool that track the changes made to files over time so that you can see specific versions later. The word distributed means that every developer working on a project has their own complete copy of the repository, including its history.</p>
<p>Think of Git like a time machine for your project. Every time you make meaningful progress, you can save a snapshot. If something breaks later, you can go back to a previous version easily. Instead of creating folders like <strong>project_final, project_final_v2, and project_last_final,</strong> Git manages everything systematically with a clear history.</p>
<hr />
<h2 id="heading-why-git-is-used">Why Git is Used</h2>
<p>Software development is not a one day or one time activity. Projects evolve continuously. Features are added,and that create some bugs which are fixed, and improvements are done on a regularly basis.So it becomes hard to manage thier last version so without a version control system it is a utter chaos for magnage version of your project</p>
<p>Consider a real-life example. Suppose you are building a portfolio website. Everything is working perfectly. then you decide to redesign the navigation bar after making some changes, the entire layout breaks.(which is Called <strong>Code fat gaya</strong> in industry) Without Git, you might struggle to remember what you changed. With Git, you can simply revert to the last working version within seconds.</p>
<p>Git is also extremely useful in team project . Imagine three developers working on the same project. Without version control, they might overwrite each other's work accidentally no body knows who change their code while <strong>Git</strong> ensures that everyone’s changes are tracked and merged properly.</p>
<p>In short, Git is used to:</p>
<ul>
<li><p>Track changes in code</p>
</li>
<li><p>Maintain a history of project development</p>
</li>
<li><p>Allow safe experimentation</p>
</li>
<li><p>Support team collaboration</p>
</li>
<li><p>Restore previous working versions when needed</p>
</li>
</ul>
<hr />
<h2 id="heading-git-basics-and-core-terminologies">Git Basics and Core Terminologies</h2>
<p>To use Git effectively, you need to understand some key terms.</p>
<p>A <strong>repository</strong>, also called a repo, is a folder that Git tracks. You can think server(GITHUB) as your house and a room is a rep which is watched by a camare who track every moment in the room .Repo contains your project files along with a hidden <strong>.git</strong> folder that stores commit history and configuration details. You can think of a repository as a project with memory.</p>
<p>A <strong>commit</strong> is a snapshot of your project at a particular point in time. Every commit includes a unique identifier, the author’s information, date and time, and a message describing the changes. For example, a commit message might say “New feature add kr diya ” or “XYZ feature remove kr diya.” Commits help you document your progress step by step.</p>
<p>A <strong>branch</strong> allows you to create a separate line of development. Suppose your main project is stable, but you want to experiment with a new feature like dark mode. Instead of modifying the main version directly, you create a branch. If the experiment fails, your main project remains unaffected.</p>
<p>The term <strong>HEAD</strong> refers to a pointer that indicates your current position in the commit history. In simple words, it tells Git which commit you are currently working on.</p>
<hr />
<h2 id="heading-how-git-works-internally">How Git Works Internally</h2>
<p>Git operates using three main areas: the working directory, the staging area, and the repository.</p>
<p><img src="https://miro.medium.com/1%2AdiRLm1S5hkVoh5qeArND0Q.png" alt="https://miro.medium.com/1%2AdiRLm1S5hkVoh5qeArND0Q.png" /></p>
<p><img src="https://miro.medium.com/v2/resize%3Afit%3A1400/0%2AGalnq-iwwHHWYzmN.png" alt="https://miro.medium.com/v2/resize%3Afit%3A1400/0%2AGalnq-iwwHHWYzmN.png" /></p>
<p><img src="https://earthdatascience.org/images/earth-analytics/git-version-control/git-add-commit.png" alt="https://earthdatascience.org/images/earth-analytics/git-version-control/git-add-commit.png" /></p>
<p>4</p>
<p>The <strong>working directory</strong> is where you write and modify your files. When you make changes, they exist only in this area initially.</p>
<p>The <strong>staging area</strong> is like a preparation zone. Before saving changes permanently, you select which files should be included in the next commit.</p>
<p>The <strong>repository</strong> is where Git permanently stores your committed snapshots.</p>
<p>You can imagine it like preparing an assignment. Writing answers happens in the working directory. Reviewing and selecting final content happens in the staging area. Submitting the assignment is similar to making a commit.</p>
<hr />
<h2 id="heading-common-git-commands">Common Git Commands</h2>
<p>To begin using Git, you need to know some essential commands.</p>
<p>The command <code>git init</code> initializes a new Git repository in your project folder. This is usually the first command you run when starting a project.</p>
<p>The command <code>git status</code> shows the current state of your project. It tells you which files are modified, staged, or untracked.</p>
<p>The command <code>git add</code> moves files from the working directory to the staging area. You can add specific files or use <code>git add .</code> to stage all changes.</p>
<p>The command <code>git commit -m "message"</code> saves your staged changes permanently in the repository with a descriptive message.</p>
<p>Finally, <code>git log</code> displays the commit history, allowing you to view all past changes in chronological order.</p>
<hr />
<h2 id="heading-a-simple-developer-workflow">A Simple Developer Workflow</h2>
<p>A beginner-friendly Git workflow looks like this:</p>
<p>First, create your project folder and run <code>git init.</code> Then create or modify files as needed. After making changes, use <code>git status</code> to see what has changed. Next, use <code>git add .</code> to stage the changes. Finally, use <code>git commit -m "Your message"</code> to save a snapshot.</p>
<p>This cycle—modify, stage, commit—is repeated throughout the project’s life.</p>
<p>Over time, your commit history forms a chain.</p>
<p><img src="https://user-images.githubusercontent.com/44003176/103466403-36a81780-4d45-11eb-90cc-167d210d7a52.png" alt="https://user-images.githubusercontent.com/44003176/103466403-36a81780-4d45-11eb-90cc-167d210d7a52.png" /></p>
<p><img src="https://user-images.githubusercontent.com/464795/115330193-947c3600-a161-11eb-9e2b-888fa04f7e34.png" alt="https://user-images.githubusercontent.com/464795/115330193-947c3600-a161-11eb-9e2b-888fa04f7e34.png" /></p>
<p><img src="https://learn.microsoft.com/en-us/devops/_img/history-abcd-cool-new-feature-e-f-merge-1.png" alt="https://learn.microsoft.com/en-us/devops/_img/history-abcd-cool-new-feature-e-f-merge-1.png" /></p>
<p>4</p>
<p>Each commit builds upon the previous one, creating a timeline of your project’s evolution.</p>
<hr />
<h2 id="heading-conclusion">Conclusion</h2>
<p>Git is not just another tool ,it is <strong>a blessing for developer</strong>.It is a fundamental skill that allows you to manage changes easily , collaborate with others, and maintain a reliable history of your work.</p>
]]></content:encoded></item></channel></rss>