Skip to main content

Command Palette

Search for a command to run...

Stop Being Afraid of Git: A Beginner’s Guide

Published
3 min readView as Markdown
Stop Being Afraid of Git: A Beginner’s Guide

So in the previous blog, we talked about how things go completely off when you don’t use version control. You know the pain of naming folders final_final_v2.zip, final_final_REAL.zip, and somehow you won’t be able to find the correct one.

Today, let’s talk about the one tool that saves developers from losing their minds: Git.

If you’re learning any programming language, or honestly building anything bigger than a calculator app, Git is non-negotiable. Think of it as your safety net. Mess up? No problem. Git’s got your back.

Let’s keep this practical. No boring textbook stuff.

So… what even is Git?

In very simple terms, Git is like an Undo button for your code, except way more powerful.

It keeps track of every change you make to your code, so even if you break something badly, you’re never truly stuck.

And yes, you will break things. That’s normal.

A Simple Git Story (How You’ll Actually Use It)

Let’s say you’re starting a new project.

Step 1: git init

First things first, you tell Git: “Hey, this folder matters.”

git init

Behind the scenes, Git creates a hidden .git folder. You won’t touch it, but from now on, Git is watching everything you do in this folder.

Step 2: git status (your new best friend)

If there’s one command you should remember, it’s this one.

git status

It tells you:

  • What files changed

  • What files are new

  • What Git is confused about

Any time you feel lost, just run git status.

Step 3: git diff

Have you ever looked at your code and thought,
“Wait.. what did I even change?”

That’s where this comes in handy.

git diff

It shows you the exact lines you changed. Old code vs new code, side by side.

Step 4: git add (staging your changes)

Git doesn’t save everything automatically. You first choose what you want to save.

git add index.html   # just one filegit add .            
                     # everything (usually what you want)

This step is basically you telling Git:
“These changes are ready. Don’t ignore them.”

Step 5: git commit

Now you actually save a snapshot of your code.

git commit -m "Added navbar"

A commit is like a checkpoint in a game.

Try to keep the message clear so that in future if you look at it will make sense.

Step 6: git log

Want to see your entire history of commits?

git log

You’ll see:

  • Commit IDs

  • Who made them

  • When they were made

It’s basically your project’s timeline.

When Things Go Wrong (Because They Will)

Option 1: git reset (danger zone !!)

This is the “erase history” button.

git reset --hard <commit-id>

Use this only when:

  • Changes are local

  • You haven’t pushed anything

  • You’re 100% sure

Otherwise… you will regret it.

Option 2: git revert (safe and sane)

This is the smarter choice for beginners.

git revert <commit-id>

Instead of deleting history, Git creates a new commit that undoes the bad one.
Your timeline stays clean, and teammates don’t get confused.

Some Real Beginner Advice

  • Run git status way more than you think you need to.

  • Don’t wait too long to commit, small commits are better.

  • If git reset scares you, good. Use git revert instead.

Learning Git is honestly like learning to ride a bicycle.

At first, you’re scared of falling. Then one day it just clicks, and suddenly you can’t imagine coding without it.

More from this blog

S

Subender.Dev

13 posts