TechnologyGitBeginner

Git 101

Your code is sitting in a folder called final-final-v3. Nobody can see it. Nobody can trust it. Git fixes that — and it is not as scary as it looks.

May 2026 · 10 min read
A warm desk scene with a laptop showing a terminal, surrounded by polaroid snapshots and a branching twig — visual metaphors for Git commits and branches

Somewhere on your laptop right now, there is a folder with real work in it. Maybe it is called python-practice. Maybe it is called project-FINAL-v2-USE-THIS-ONE. Maybe it lives in Downloads, which is where ambition goes to die.

That folder might contain weeks of effort. But from the outside? It is invisible. A hiring manager cannot see it. A collaborator cannot trust it. Future-you will open it in six months and wonder what any of it means.

Git fixes all of that. Not by making your code better — but by making your process visible.

What Git actually is (and is not)

Think of Git as a journal for your project. Every time you reach a meaningful point — fixed a bug, added a feature, got something working at 2 a.m. — you write an entry. That entry is called a commit. It records what changed, when, and why.

Now imagine you could flip back to any page in that journal and your entire project would rewind to exactly that state. That is Git. A time machine with better naming conventions.

Git vs. GitHub — they are not the same thing.

Git is the engine. It runs on your computer and tracks your project’s history. GitHub is a website that hosts your Git history online so other people can see it. Git works perfectly without GitHub. GitHub is where your Git history becomes a public asset.

Think of it this way: Git is the camera. GitHub is the gallery.

The glossary nobody gives you first

Most Git tutorials fail because they throw commands at you before you know what the commands touch. Here is the plain-English map. Tape it to your wall if you need to.

Terminal A text box where you type instructions to your computer. Less friendly than clicking, far more precise.
Repository (repo) A project folder that Git is watching. Your files plus a hidden history database.
Commit A snapshot of your project at a moment in time, with a note explaining what you did. Think “save point in a video game.”
Staging area A draft tray. You choose which changes go into the next commit. Not everything has to go in at once.
Branch A parallel timeline. You can experiment here while the main version stays safe. Like drafting on scratch paper before writing in ink.
Merge Bringing work from one branch back into another. The scratch paper becomes the final copy.
Remote A copy of your repo hosted somewhere else — usually GitHub. Your laptop is local. GitHub is the remote.
Push Sending your local commits up to the remote. Like mailing your journal pages to the archive.

Git is four rooms, not one magic spell

Here is where most people get confused. They think Git is one thing. It is actually four spaces, and your files move through them like luggage through an airport.

The airport analogy. Your project files start in the working directory (the parking lot — you are still editing). When you are ready, you move them to the staging area (the check-in counter — you are choosing what to send). Then you commit (the flight departs — it is in the local history). Finally, you push to GitHub (the luggage arrives at the destination — now everyone can see it).

  1. Working directory — your actual project folder. Edit freely here. Nothing is tracked yet.
  2. Staging area — the draft tray. You pick which changes are ready for the next snapshot.
  3. Local repository — your commit history, stored in a hidden .git folder on your machine.
  4. Remote repository — the GitHub copy. Public, shareable, and inspectable by anyone you give access to.

Once you see these four rooms, the commands become ordinary verbs: inspect the working directory, add changes to staging, commit them to history, push that history to the remote. That is the whole workflow.

The workflow, slow and clear

Let us walk through the entire process. You have a folder with a Python script called hello.py. You want to track it with Git and eventually put it on GitHub. Here is every step.

1. Turn your folder into a Git repo

# navigate to your project folder first, then: git init

This creates a hidden .git directory inside your folder. That hidden directory is where Git stores everything. You will never need to open it — just know it exists. Your folder is now a repository.

2. Check what Git sees

git status

This is the command you will run most often. It tells you what has changed, what is staged, and what is ready to commit. Think of it as asking Git, “What is going on right now?” Run it early, run it often, run it when confused. It never hurts.

3. Stage your file

git add hello.py

This moves hello.py into the staging area. You are saying: “Include this in the next snapshot.” You can stage one file, three files, or everything — you choose. This is the check-in counter.

4. Commit — take the snapshot

git commit -m "add first Python script"

Done. Your staged changes are now saved in the project timeline with a message that explains what you did. That message matters — it is a note to future-you and anyone who reads your history. “fixed stuff” is a crime. “Add input validation to login form” is a gift.

The Polaroid analogy. Each commit is a Polaroid of your project. You can take as many as you want. You can always go back and look at any one. But unlike a Polaroid, you can also restore your project to the exact state in that snapshot. It is a time machine disguised as a save button.

5. Check again

git status # ideally: "nothing to commit, working tree clean"

That clean status message is the most satisfying sentence in programming. Everything is saved. Everything is tracked. You can close your laptop and walk away knowing nothing is lost.

Branches: the safety net you did not know you needed

Here is a scenario. You have a working script. It does what it is supposed to do. Now you want to add a new feature, but you are not sure it will work. Do you edit the working version directly and pray?

No. You create a branch.

The notebook analogy. Imagine your project is a notebook with clean, finished pages. A branch is a loose sheet of scratch paper clipped to the side. You can scribble, experiment, cross things out — and if it works, you copy it into the notebook. If it does not work, you throw the scratch paper away. The notebook never got messy.

# create a branch and switch to it git switch -c improve-script # make your edits, then stage and commit git add hello.py git commit -m "improve script output formatting" # happy with it? switch back to main and merge git switch main git merge improve-script

That is it. You experimented safely, and when the experiment worked, you folded it into the main timeline. Professional developers do this dozens of times a day. It is not advanced — it is just the habit of not gambling with working code.

Publishing to GitHub: making invisible work visible

Up to this point, everything lives on your computer. That is already valuable — you have a recoverable history and you can undo mistakes. But it is still invisible to the world.

To make it public, you connect your local repo to a GitHub repository and push.

# connect your local repo to GitHub (do this once) git remote add origin https://github.com/YOUR-USERNAME/YOUR-REPO.git # push your commits and set tracking git push -u origin main

Refresh the GitHub page. Your files, your commit history, your branch structure — all of it is now visible to anyone with the link. What was a private folder is now a public portfolio.

This is the shift that matters. A GitHub repo does not just store code. It answers questions before they are asked. Can this person write clean code? Are their changes organized? Do they work in branches? Do their commit messages make sense? A good repo is a silent interview that runs 24/7.

The command cheat sheet

You do not need to memorize these. Bookmark this page and come back when you need one.

What you want to doCommandPlain English
Start tracking a foldergit initCreate Git’s history storage inside this folder.
Check the situationgit statusWhat changed? What is staged? What is committed?
Stage one filegit add file.pyPut this file in the next snapshot draft.
Stage everythinggit add .Add all changed files. Use carefully.
Save a snapshotgit commit -m "msg"Record staged changes with a short note.
Create a branchgit switch -c nameStart a new parallel timeline.
Switch branchesgit switch mainGo back to the main timeline.
Merge workgit merge nameFold a branch’s work into the current branch.
Connect to GitHubgit remote add origin URLTell Git where the remote lives.
Upload historygit push -u origin mainSend your commits to GitHub.
See commit historygit log --onelineOne-line summary of every snapshot.

The mistakes everyone makes (and how to survive them)

“I typed get instead of git.”

The command is git. If your terminal says “command not found,” check spelling first. Then check if Git is installed. On Mac, typing git in Terminal usually triggers an install prompt. On Windows, download Git from git-scm.com.

“GitHub is asking for a login.”

That is normal when you push for the first time. You will need to authenticate — usually through a browser login, SSH key, or personal access token. It is a one-time setup that feels annoying and then never bothers you again. Like flossing.

“I committed the wrong file.”

Do not panic. Git is designed for recovery. The beginner-safe fix: make a new commit that corrects the mistake. Do not try to rewrite history on day one. That is surgery, and you are still learning to use a band-aid.

“My branch is called master, not main.”

Older repos use master as the default branch name. Newer ones use main. They work the same way. Run git branch to see what yours is called and use that name instead.

Do not let your work stay invisible

Here is the thing nobody tells beginners: the code itself is only half the story. The other half is proof that you built it thoughtfully. A clean Git history shows that you plan before you code, you isolate experiments from stable work, you write clear messages about what you did and why, and you ship incrementally instead of dumping everything at once.

That is not just good version control. That is how professionals work. And it starts with six commands:

git init # start tracking git add . # stage your work git commit -m "msg" # take the snapshot git switch -c feat # branch for safety git merge feat # fold it back in git push # show the world

One script. One repo. One commit. One push. That is your first step out of the final-final-v3 folder and into something people can actually see, trust, and respect.

The best time to start using Git was your first project. The second best time is right now.

VJ

A note on how I write

I am not a writer. I am a person with strong opinions and scattered notes. Every essay on this site started as a messy brain-dump — half-formed arguments, bullet points, and “you know what I mean” — that I hand to an LLM. Another LLM handles the background research needed to find the facts that support an argument. And then it all gets translated into writing far too good for me to pretend is mine. The ideas are mine. The craft is not. They say blogs are dead — but I am falling in love with this. It gives me an outlet for expression that would otherwise have stayed buried in my head. I believe you deserve to know all of that.