Working tree, index & commits
Git is a photo studio. The working tree is the messy set. The staging area is what you've arranged in front of the camera. A commit is the photo: permanent, labelled and filed in the album (the repository).
A time machine you can't afford to break. The three areas, merge vs rebase, reset vs revert, stash, conflicts and the branching workflow teams actually use.
Git is a photo studio. The working tree is the messy set. The staging area is what you've arranged in front of the camera. A commit is the photo: permanent, labelled and filed in the album (the repository).
Merge ties two storylines together with a knot: the history shows exactly what happened, knots and all. Rebase rewrites your chapter as if you'd started it after the latest chapter: a straight, tidy story, but with new page numbers.
Reset is tearing pages out of your own notebook — fine before you've shown anyone. Revert is writing a new page that says “ignore page 12” — the only polite option once other people have a copy.
Stash is a desk drawer. Sweep your half-finished work into it, fix the urgent bug on a clean desk, then pull the work back out.
A conflict is Git saying: “You and your teammate both rewrote the same sentence. I won't guess which version is right.”
Trunk-based development: everyone works on short-lived branches off main and merges daily, hiding unfinished features behind flags. GitFlow: long-lived develop and release branches — heavier, and suited to scheduled releases.
Each topic pairs a plain-language explanation with code, interview questions, and related practice where available.