Git Command Explorer & Laboratory
Deep-dive into side-by-side command behaviors, toggleable flag simulations, crisis triage escapes, and under-the-hood 4-zone plumbing.
Interactive Flag Builder & Output Simulator
Toggle flags to see the live assembled syntax and simulated terminal stdout.
Customize how commit history is formatted and filtered.
--onelineOne-line FormatCompress each commit into a single abbreviated line.
--graphASCII Tree GraphDraw a visual graph of branches and merges.
--allAll RefsShow commits from all local branches and remote tracking tips.
--statFile StatisticsDisplay insertion and deletion counts per file.
-n 3Limit to 3Show only the 3 most recent commits.
Action: Executes commit inspection with --oneline, --graph formatting.
"Oh Shit, Git!" Recovery Protocols
Pick a panic scenario to see exact rescue commands, explanations, and recovery output.
You ran `git branch -D feature-login` thinking you didn't need it, but had unmerged commits you now need back.
Git never deletes commits immediately; commits stay in the reflog database for 30-90 days. We find the lost commit hash in the reflog and attach a new branch pointer to it.
git reflog git checkout -b feature-login-recovered <commit-sha>
$ git reflog -n 3
7f8a12e (HEAD -> main) HEAD@{0}: checkout: moving from feature-login to main
7f8a12e HEAD@{1}: commit: feat(login): implement auth form
$ git checkout -b feature-login-recovered 7f8a12e
Switched to a new branch 'feature-login-recovered'4-Zone Plumbing & Data Flow Inspector
Visualize how Git moves data and pointers across the 4 architectural layers.
1. Working Tree
Unstaged Files on Disk
2. Staging Area
The Index (.git/index)
3. Local Repo
HEAD & Commit Store
4. Remote Origin
GitHub / GitLab Hub
$ git add <file>Creates SHA blob objects in `.git/objects` and registers their paths in `.git/index`.
None. HEAD stays untouched.
Untracked files: (use "git add <file>..." to include) src/auth.ts
Changes to be committed: (use "git restore --staged <file>...") new file: src/auth.ts
Side-by-Side Command Comparer
git merge featureCombines branches by creating a new merge commit with two parents. Preserves complete historical context.
- Preserves true chronological order
- Non-destructive to existing SHAs
- Clear record of when branches merged
git rebase mainReplays branch commits on top of main, creating duplicate commits with new timestamps to produce a clean single line.
- Creates clean, linear git log
- Easier to bisect and cherry-pick
- Eliminates clutter merge commits
Real-World Recipe Scenarios ("I Messed Up, How Do I Fix It?")
Committed to Wrong Branch
You accidentally made 2 commits directly on the `main` branch instead of creating a feature branch first.
Fix Typo in Last Commit
You committed with a typo in the message: "Add usre autentication" and forgot to include `types.ts`.
Stage Only Selected Lines
You modified `app.ts` with both a bug fix AND experimental testing code. You only want to commit the bug fix.
Quick Glossary Reference
A permanent snapshot of your project at a specific moment in time. Every commit has a unique SHA hash fingerprint.
The "You Are Here" pointer in Git. It tracks which commit or branch your working folder is currently looking at.
A state where your HEAD is pointing directly to a specific commit instead of a named branch. You can explore without changing any branch.
A lightweight movable label that points to the latest commit on a line of development. Branches let you work on new features without breaking main.
A merge where Git simply moves the branch pointer forward because no diverging commits occurred on the destination branch.
A merge between two diverged branches where Git finds the common ancestor and creates a new merge commit combining both histories.