Skip to main content

Command Palette

Search for a command to run...

Understanding Git : insideout

Published
•3 min read•View as Markdown
Understanding Git : insideout

When you first hear about Git, it often sounds complicated - lots of commands, strange words, and rules.
But Git is actually built to solve a very simple problem:
How do developers safely track changes in code over time?

Let’s understand Git step by step using the diagrams below.

What is Git?

Git is a version control system.

In simple words, Git helps you:

  • keep a history of your code by creating and storing objects not codebases.

  • save different versions safely.

  • go back to older versions if something breaks.

Instead of copying folders like project_final or project_final_v2, Git manages everything for you automatically.

Why Git Is Used

Developers use Git because:

  1. Code changes all the time

  2. Mistakes happen

  3. Multiple people work on the same project

Git makes sure:

a. Nothing is lost so that if enything goes wrong then we can revert to previous version without any issues.

b. Every change is recorded so that everyone can be accountable in team.

c. Teamwork stays organized and it does not become damage control.

Git Basics and Core Terminologies

Working Directory, Staging Area, Repository

Look at the first diagram.

This shows how Git handles your code internally.

  1. Working Directory

    • This is where you write and edit files

    • Git is not tracking changes yet

  2. Staging Area

    • When you run git add, files move here

    • You are telling Git:
      “I want to include this in the next save”

  3. Repository

    • When you run git commit, Git saves a snapshot

    • This snapshot is stored permanently in history

Git does not save files directly instead, it saves snapshots of your project.

Commit and Commit History

Look at the above diagram: Commit History Flow.

Each box is a commit along with a unique message:

  • Commit 1 → Initial commit

  • Commit 2 → Feature added

  • Commit 3 → Bug fixed

Each commit represents a point in time which points to the previous commit and forms a chain called commit history

This is why you can see old changes, understand what happened when and undo mistakes safely

Core Git Terms (Simple Meaning)

  • Repository: A project managed by Git

  • Commit: A saved snapshot of your code

  • Branch: A separate line of development

  • HEAD: Points to where you are currently working

You don’t need to memorize these - they make sense as you use Git.

Common Git Commands

The third diagram shows commonly used Git commands and how they fit together.

Basic Commands

  • git init: Starts Git tracking in a folder

  • git status: Shows what has changed

  • git add: Moves changes to the staging area

  • git commit: Saves changes permanently

  • git log: Shows commit history

Other Useful Commands

  • git diff - see changes

  • git branch - manage branches

  • git merge - combine work

  • git pull / push - sync with remote

  • git clone - copy a repository

A Simple Git Workflow (From Scratch)

  1. First create a project folder

  2. Run git init

  3. Write some code

  4. Run git status

  5. Stage changes using git add

  6. Save them using git commit

  7. Repeat as you improve the project

That’s it. This loop is Git.

Conclusion

So we get to know that - Git is not about commands.
It’s about tracking progress.

Once you understand:

  1. working directory

  2. staging area

  3. commits and history

Git becomes predictable, not scary.

Learn the flow, not the fear -
and Git will feel like a helpful assistant, not a burden.