Git Happens: From Mess to Success


Ctrl + Z Doesn’t Work Here
If you’ve ever worked on a software project, you’ve probably heard of Git. Yep right, that magical tool developers use to not destroy each other’s code, or at least try not to.
Git is literally everywhere: from open-source side projects to the codebases of billion-dollar giant tech companies. Its the foundation to modern collaborative coding.
And Well to be honest, if you have any experience with the same you would agree that getting started with Git feels less like opening a helpful tool and more like stepping into a black hole of commit messages and branch confusion.
One moment you’re typing “git commit” the next you’re Googling “how to undo git commit”.
Relatable?
The Early Struggles: Learning Git Basics
When someone first introduced me to git, they said something along the lines of —“It's easy. You just add, commit and push. Simple!”
Simple?
That was the biggest lie I’d heard since “Group project means equal effort.”
Anyway let’s break this down, because Git basics aren’t exactly basic when you’re just starting out.
Step 1: git add .
Okay, cool. You’ve written some beautiful (probably buggy) code. Now someone tells you to run git add . , and you do it… but nothing happens.
Was it added? Where did it go? Is it hiding?
No visual feedback. No popup. Just a silent terminal pretending like everything’s fine. You’re left wondering if you just did something amazing or irreversibly catastrophic.
Think of it as organizing papers on your desk before putting them in a binder. The staging area gives you control, you can choose what to include, leave out half-done stuff, or split your work into tidy, meaningful commits.
NOTE: git add . stages all the changes(new, modified, deleted files) in your current directory and all subdirectories. It’s like saying “Yes, Git ,take it all”.
(Be careful though, that includes accidental additions too.)
For example above, after git add the files go to the staging area. Running git status will show:
Step 2: git commit -m “message”
Now comes the commit. The part where you're supposed to summarize your changes like a responsible developer. This command takes a snapshot of your staged changes, basically saving your progress, along with a message describing what you changed.
Think of it like hitting “Save” in a game, but for your code. The message you write with -m should explain what you did, so future-you (and your teammates) know what you changed and why.
Sounds simple, right?
Well let’s be honest, your early commit messages probably looked like this:
(i) git commit -m "fixed stuff"
(ii) git commit -m "small changes"
(iii) git commit -m "final version"
SPOILER ALERT: it’s never the final version.
Because two commits later, you're typing-
(iv) git commit -m "final final version"
(v) git commit -m "final final final version"
(vi) git commit -m "fully final final use this one version".
By the time you’re at "fully final final final use this one version", Git’s probably judging you harder than your code reviewer.
And somewhere in the chaos, you realize you forgot to add the actual file you worked on and have committed the wrong files.
For reference in the example before we progressed to git commit and now a snapshot of these changes have been recorded. Running git log will show your new commit at the top:
Step 3: git push
So basically after you’ve added your changes and committed them, comes git push, the final boss. This command sends your local commits to a remote repository, like GitHub, so others can see (and hopefully not judge) your work.
With sweaty palms, you summon the courage to type git push, and boom, git is ready with its own set of tantrums.
Your terminal hits you with:
“everything up-to-date” (it’s totally not)-The ultimate troll message that makes you question reality.
“rejected by remote” -Git’s way of saying, “Nope. Not today, buddy.”
“fatal: The current branch has no upstream branch.” -“Basically Git doesn’t know where to send your code.”
“you are not currently on any branch” - What? Is this even possible?
“hint: Updates were rejected because the tip of your current branch is behind” -
A mic drop moment:
“You forgot the most sacred rule: pull before you push! Someone else has sneaked in and changed the code while you were busy writing your masterpiece(broken code).Skip it, and you’ll wake up with a merge-conflict migraine so brutal that no nap can fix!”
This sends your commits to the main branch on the remote repository. After pushing, teammates can pull these changes and benefit from your latest updates.
Pulled the Code- Welcome “Merge Conflicts”
Now, like a responsible coder you pulled the code, only for git to betray you yet again. VS code now looks like it is screaming-something is just not right and you encounter the thing every developer is secretly terrified of- A Merge Conflict
Now you have four choices:
(i) Accept Current (your changes)
(ii)Accept Incoming (their changes)
(iii)Accept Both (if you’re feeling lucky)
(iv)Compare (brave people choose this)
You choose one, hoping that nothing breaks and sometimes you survive it.
Other times?
Well, I myself have messed it up so badly that I deleted my entire fork and re-forked the repo, not once, but multiple times during my early Git journey(I still do).
It’s messy, it’s frustrating, and it’s part of the learning curve. But every conflict you resolve makes you just a little bit better at reading code, understanding changes, and staying calm under pressure.
PRO-TIP : Don't just blindly accept both, because sometimes you might end up with extra semicolons and a debugging session that could last an hour. Keep an eye out for <<<<<<<, =======, and >>>>>>>—Git’s not-so-subtle way of saying, “We have a problem.”
It’s up to you to step in, settle the conflict, and clean up the mess by removing those arrows.
From Confusion to Clarity: The Git Breakthrough Moment
Somewhere between running git status countless times and resorting to git reset --hard in frustration, things gradually start to make sense. Git isn’t trying to be difficult—it’s just highly precise. One major breakthrough often comes with understanding how branches work. Rather than being confusing detours, they act as parallel environments, allowing different features or fixes to be developed without disrupting the main codebase.
Early on, learning the difference between forking a repo (creating your own copy to experiment or contribute) and cloning it (downloading a working copy to your local machine) also clears up a lot of confusion. Together, they empower you to safely explore and collaborate.
Visual tools like Git Graph in VS Code can also make a big difference. By showing the commit history and branch structure in a clear, visual format, they help demystify what’s happening behind the scenes. With time and practice, Git begins to feel less like an obstacle and more like a reliable system that brings structure and flexibility to collaborative coding.
Git Commands That Make Your Life Easier
Once the initial confusion clears, having a few go to commands and tools in your Git toolkit can make your workflow smoother and far less panic inducing.
git status: Think of this as your Git health check. It tells you what’s going on, what’s staged, what’s not, and what’s being ignored.
git stash: It's basically hiding your mess when the guests arrive. In technical terms, it saves your uncommitted changes and cleans your working directory, so you can switch branches or pull updates without losing your progress.
git revert <commit-hash> : It is the polite way to undo changes in Git. It creates a new commit that undoes the changes of a previous commit, without rewriting history.
git reset - -hard: Use it when you have messed up your local code badly, haven’t pushed yet, and just want to go back to a clean slate. It is one of the most powerful and dangerous commands in Git. It resets your working directory, staging area, and HEAD to a specific commit, discarding all uncommitted changes.
Embracing the Git Journey
Learning git might feel like a rollercoaster ride at first, full of mysterious commands and countless errors. But with time and trial, and more than a few merge conflicts, it starts to make sense. What felt like random errors now seem like clear (if slightly dramatic) warnings. The learning curve is real, but it slowly turns into a solid foundation.
Eventually, Git stops feeling like a confusing set of commands and starts to feel like a trusted sidekick. It becomes the thing that lets you try out new ideas without fear, fix mistakes without panic, and work with others without stepping on each other’s toes. The journey from “what did I just do?” to “I’ve got this” takes time, but when it clicks, it really clicks.
Subscribe to my newsletter
Read articles from Kashish Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
