Git & everyday tooling
Branching, rebase vs merge, bisect, a real debugger over print statements. Team-fit rounds quietly test whether you can work in a shared repo.
The mental model
Most people are taught Git as a list of spells: git add, git commit, git push, and when something breaks, git reset --hard and pray. That works until it doesn't, and then it fails catastrophically because you are casting spells at a system you do not understand.
The mental model that fixes this: **Git is a content-addressed database of immutable snapshots, and branches are just sticky notes pointing at snapshots.** Every commit is a complete photograph of your project's tree, named by the SHA-1 (now migrating to SHA-256) hash of its contents. A commit points at its parent(s), so the history is a directed acyclic graph — a DAG — of these photographs. A branch is not a container of commits; it is a **movable pointer** to one commit, and HEAD is a pointer to the branch you are currently on. That's the entire object model. Once you see branches as sticky notes, "rebase" stops being scary — it is just re-recording snapshots and moving the sticky note.
The analogy that sticks: Git is a **save-game system with parallel timelines**. A commit is a save point that captures the whole world. A branch is a timeline you can fork off and merge back. reflog is the console log of every save you made, including the ones you "deleted" — which is why almost nothing in Git is truly lost for weeks.
Why does this exist? Because software is built by many people editing the same files, and the fundamental problem is *reconciling divergent histories without losing work*. Every Git command is in service of that: branching to diverge safely, merging or rebasing to reconcile, and a permanent audit trail so you can always answer "who changed this line, and why". The tooling around it — bisect, a real debugger, git blame — exists because the second-hardest problem in software is not writing code but figuring out which change broke something and why.
The team-fit reality: interview loops quietly grade whether you can work in a shared repo. A candidate who force-pushes to main, writes commit messages that say "fixes", and debugs with print everywhere is a maintenance cost the team can see coming.
- Deep dive
- Internal architecture
- Real-world use cases
- Best practices
- Common mistakes
- Performance
- Security
- Production troubleshooting
- Advantages & disadvantages
- Alternatives
- Interview expectations
- Interview questions
- Facts to remember
- Cheat sheet
- Quick revision