Skip to main content

Command Palette

Search for a command to run...

#14 GIT | 20 Lakh Job Hunt

Published
6 min read
#14 GIT | 20 Lakh Job Hunt
P

"Passionate DevOps enthusiast, automating workflows and optimizing infrastructure for a more efficient, scalable future."

Guide to Git and Version Control

Version Control Systems (VCS) are fundamental to modern software development. Whether you're working alone or collaborating with a team, version control helps track changes, maintain history, recover mistakes, and manage code smoothly.
In this post, we walk through the essentials of Git — the most popular distributed version control system — along with practical exercises to help you build confidence.


What is Version Control?

A Version Control System (VCS) is a tool that tracks changes to files over time. It helps you:

  • View previous versions of files

  • Understand who made changes and why

  • Work with others without overwriting each other’s work

  • Experiment safely through branches

  • Tag important states (like releases)

Although often used for software, VCS can be used for any project that involves versioned files.

Git is one of the most powerful VCS tools — fast, free, scalable, and open-source — originally created by Linus Torvalds.


Distributed Version Control: Why Git Is Different

Older tools like CVS and SVN rely on a central server. If the server goes down, you lose access to your history.

Git is distributed, which means:

  • Every developer has a full copy of the entire history.

  • You can work offline and sync later.

  • There’s no single point of failure.

  • A server is optional (though platforms like GitHub simplify collaboration).


Key Git Terminology

Understanding these terms will make Git much easier:

  • Working Tree – Your local project files.

  • Repository (Repo) – Where Git stores project history (.git folder).

  • Hash – A unique SHA-1 identifier for each Git object.

  • Objects – Blobs (files), trees (directories), commits, and tags.

  • Commit – A saved “snapshot” of your project.

  • Branch – A name for a series of commits (default: main).

  • Remote – A reference to a remote repository (default: origin).

  • Commands / Subcommands / Options – e.g., git push, git pull, git reset --hard.


Git vs GitHub

  • Git → the version control system installed on your machine.

  • GitHub → an online hosting platform built on top of Git.

GitHub adds collaboration features:

  • Issues

  • Discussions

  • Pull Requests

  • Actions

  • Notifications

  • Forks

  • Project boards


Exercise: Configure Git

Start by checking your Git version:

git --version

Then configure your username and email:

git config --global user.name "<USER_NAME>"
git config --global user.email "<USER_EMAIL>"

Verify:

git config --list

Exercise: Create Your First Git Repository

  1. Create the folder:
mkdir Cats
cd Cats
  1. Initialize Git:
git init -b main
  1. Check status:
git status
  1. View hidden .git folder:
ls -a

Basic Git Commands

git status

Shows the current state of your working directory and staging area.

git add

Stages files for commit:

git add .

git commit

Saves your staged changes:

git commit -m "Your message"

git log

Shows commit history.

git help

Displays documentation for any Git command.


Exercise: Track Your First File

  1. Create a file:
touch index.html
  1. Stage and commit:
git add .
git commit -m "Create an empty index.html file"
  1. Add HTML:
<h1>Our Feline Friends</h1>
  1. Commit the change:
git commit -a -m "Add a heading to index.html"

Exercise: Editing and Tracking Changes

Add more HTML:

<!DOCTYPE html>
<html>
  <head>
    <meta charset='UTF-8'>
    <title>Our Feline Friends</title>
  </head>
  <body>
    <h1>Our Feline Friends</h1>
    <p>Eventually we will put cat pictures here.</p>
    <hr>
  </body>
</html>

Check changes:

git diff

Commit:

git commit -m "Add HTML boilerplate to index.html" index.html

Ignoring Unwanted Files

Create a .gitignore:

code .gitignore

Add:

*.bak
*~

Commit:

git add -A
git commit -m "Make small wording change; ignore editor backups"

Adding a Subdirectory

mkdir CSS
touch CSS/.git-keep
git add CSS

Replace .git-keep with actual CSS:

cd CSS
code site.css

Add:

h1, h2, h3, h4, h5, h6 { font-family: sans-serif; }
body { font-family: serif; }

Update HTML to link CSS:

<link rel="stylesheet" href="CSS/site.css">

Commit:

git add .
git commit -m "Add a simple stylesheet"

Viewing Commit History

git log
git log --oneline
git log -n2

Fixing Mistakes in Git

1. Amend a Commit

git commit --amend --no-edit

Useful for correcting files or commit messages.


2. Recover a Deleted File

Deleted with rm:

rm index.html
git checkout -- index.html

Deleted with git rm:

git reset HEAD index.html
git checkout -- index.html

3. Revert a Commit

When a bad commit is already in history:

git revert --no-edit HEAD

This creates a new commit that undoes the previous one.

Summary

In this guide, you learned:

  • What version control is

  • Key Git concepts and terminology

  • How Git differs from GitHub

  • Initial Git configuration

  • Creating and managing repositories

  • Tracking, editing, and committing files

  • Using .gitignore

  • Restoring deleted files

  • Reverting commits safely


A Day with 80 Thousand Thoughts

Yes — 80 thousand thoughts a day. That’s crazy. It feels like my mind doesn’t sit still for even a second. I’m constantly thinking about what more I can do, what more I can learn, and what extra I can push myself through to reach my goal.

Everyone I meet says it’s impossible.
I say: F*ck it, I’ll still do it.

Why?
Because I have an unshakable belief that I will get everything I’m working for. I wished for this, and I’ll get it.

There’s a lot happening, a lot changing every day. I’m becoming aware of how naive I used to be, how short-tempered I have been in the past. I’m looking at my flaws and fixing them. At the same time, I’m looking at the things that no one can beat me at — my mindset. And honestly, it doesn’t surprise me, because mentally, I’m already ahead of most.

This is my prime. My time to live, to learn, and to achieve. And I will make it count.

The dream is big — it feels like climbing the highest mountain in the worst weather. But that’s the thrill. You bow down to the dream, rise again, and walk back into the storm because the goal demands it.

And that dream?
It’s so much bigger than a 20-lakh job.
That’s just a stepping stone.
And I’ll step on it soon.

So yes — F*ck the 80 thousand thoughts.
Because the only thought that matters is:
WIN.


Connect with Me

More from this blog