Writing
Blog
Writing on React, web performance, and the craft of building software.
Blog
DevOps & Tooling
Everything About Git
Expand All
01
Introduction
4 articles
•
Not started
1
The Git Manual Is Already On Your Machine
5 min read
•
Git ships with a complete manual for every command it has. The reason almost nobody reads it is that nobody teaches you how to move around inside it.
2
Why Distributed Version Control Changed Everything
6 min read
•
Before git, one person editing a file could block everyone else. Understanding what replaced that explains most of git's vocabulary, and the three states every file moves through.
3
Every Commit Is The Whole Project
5 min read
•
Almost everyone assumes a commit stores the lines you changed. It stores the entire project, and once that lands, half of git's weirder commands stop being weird.
4
Configuring Git Before You Use It
4 min read
•
The setup step you did once years ago and never thought about again. Git's config is layered, and knowing that is what stops personal commits going out under a work email.
02
Git Basics
5 articles
•
Not started
1
What Git Init Actually Creates
5 min read
•
Most developers have cloned a hundred repositories and created zero. Running git init once, then reading what it produced, explains more about git than any tutorial.
2
The Three Commands That Cover Most Of Git
5 min read
•
Add, commit, and status will carry you through most of a career. Running them slowly once, checking status between every step, is what makes the rest of git legible.
3
Reading History With Git Log
4 min read
•
Two flags turn git log from a wall of text into a readable graph, and one of them behaves differently the moment you pipe the output somewhere.
4
Finding Your Commit Inside The Git Folder
4 min read
•
Your commit is a file on disk, and you can go find it by hand. The first two characters of the SHA are the directory name, which is the moment git stops being abstract.
5
Walking A Commit Down To Trees And Blobs
6 min read
•
Follow a commit to its tree, and the tree to its blob, and you arrive at your own file contents. Do it twice and you can see git reusing a pointer instead of storing a copy.
03
Branching Merging Rebasing
6 articles
•
Not started
1
Your Git Config Is Just A File
5 min read
•
Config commands look like a database API and turn out to be a text file with sections in brackets. Which explains the one behaviour that surprises everybody.
2
Branches Are Just A File With A Sha In It
4 min read
•
Creating a branch prints nothing and moves you nowhere, which feels broken the first time. Finding the file it wrote explains both the silence and why branches are free.
3
Why Some Merges Make A Commit And Some Dont
5 min read
•
Sometimes a merge opens an editor demanding a message, and sometimes it silently finishes. That is not random. One question about your history decides it every time.
4
Rebase And When Not To Use It
5 min read
•
Rebase has a bad reputation earned mostly by one mistake people make once. The mechanics take four steps to explain, and the rule that keeps you safe takes one line.
5
Head And Reflog Are Both Just Files
4 min read
•
HEAD has been in every log line so far without explanation. It is one line of text, and the reflog next to it is a plain append-only file that git prints backwards.
6
Recovering A Deleted Branch
5 min read
•
Delete a branch with unmerged work and every normal git view stops showing it. Here are three ways to get it back, including one that rebuilds the file by hand from a SHA.
04
Remote Repositories
3 articles
•
Not started
1
A Remote Is Just Another Copy Of The Repo
5 min read
•
A remote does not have to be remote. Make one in a folder next to your project, and the thing everyone calls GitHub stops looking like part of git at all.
2
Git Pull And Why It Needs Tracking
5 min read
•
Pull is fetch and merge run back to back. It fails the first time you try it, and the error is git refusing to guess something it genuinely cannot know.
3
Push Is Pull In Reverse
4 min read
•
Fetch politely refuses to move your branches. Push moves someone else's without asking. That asymmetry looks inconsistent until you notice who is standing where.
05
Conflict Resolution
6 articles
•
Not started
1
Stash Is A Stack Of Unfinished Work
4 min read
•
You have half-finished work and need to pull. Stash is the usual answer, and knowing it is a stack rather than a drawer is most of what makes it usable.
2
Resolving A Merge Conflict By Hand
6 min read
•
Conflicts feel like git failing. They are git refusing to guess. Reading the markers directly, with no tool in the way, is what turns dread into a two minute job.
3
Rebase Conflicts And Why Ours And Theirs Flip
5 min read
•
During a rebase, HEAD is the other branch. That inversion confuses everyone once, and it can quietly delete your own commit if you resolve on autopilot.
4
When The Same Conflict Comes Back Every Time
4 min read
•
Rebase replays your commits on every pull, so a conflict you already solved returns on every pull. Git has a fix, and it is hidden behind the worst name in the tool.
5
Picking A Whole Side With Ours And Theirs
4 min read
•
Sometimes you do not want to reconstruct anything, you want one version and to move on. The command is one line, and it takes more than you think.
6
Interactive Rebase And Squashing
5 min read
•
Commit as often as you like while working, then turn the mess into one reviewable commit before anyone sees it. Interactive rebase has many options and you need one.
06
Tools And Techniques
7 articles
•
Not started
1
Searching Git Logs Before Reaching For Bisect
4 min read
•
Something worked a month ago and is broken now. Before the systematic approach, there is a one minute gamble worth taking, and three different things you can search.
2
Bisect Finds The Bad Commit In Log N Steps
5 min read
•
You need no keyword, no suspect file, and no theory about the bug. Only a way to tell working from broken. Git does a binary search through history and hands you the commit.
3
Revert Adds The Opposite Commit
4 min read
•
Reverting does not delete anything. It appends the exact inverse of a commit, which is the only way to undo published work without breaking everyone who has it.
4
Reset Soft And Hard And Commit Amend
6 min read
•
Both resets walk the branch backwards. One hands your work back as staged changes, the other destroys it. And there is exactly one way to lose work git cannot recover.
5
Worktrees Are The Answer To Stashing
4 min read
•
You are in flow, and production breaks. Stashing is the usual answer and nobody enjoys it. A second working tree means you never have to put anything down.
6
Tags And Knowing When To Use A Tool
4 min read
•
A tag is a branch that cannot move. And after a whole series insisting you resolve conflicts by hand, here is the case for putting a tool back in front of them.
7
The Last Few Things About Git
5 min read
•
Large files, environment files, an ignore list only you can see, and why keeping a change under 150 lines matters more than any command in this series.
Everything About Git | Writing & Engineering | Durgesh Rai