Git Cheat Sheet
Comprehensive, interactive Git reference guide. Features dynamic command generation, visual graph simulations, and safety warnings for destructive operations.
About
Git is the industry-standard distributed version control system, essentially a directed acyclic graph (DAG) of filesystem snapshots. While powerful, its syntax (CLI) is often non-intuitive, leading to the infamous "xkcd strategy" (delete repo and clone again). This tool solves the Cognitive Load problem by mapping intent to syntax.
Accuracy in Git is critical. A misplaced force push or an accidental hard reset can obliterate hours of work or corrupt shared history. This utility acts as a semantic bridge, offering context-aware command generation and visual safety indicators for destructive operations.
Formulas
Git operations can be modeled using Set Theory and Graph Theory. A repository R is a set of commit objects connected by directed edges.
1. Merge Operation (Union):
A merge creates a new commit Cm that has two parents.
2. Rebase (Linearization):
Rebase replays commits Ci from the source branch onto the target base Bt.
3. Diff (Symmetric Difference):
Showing changes between two references.
Reference Data
| Placeholder | Description | Default Value | Context |
|---|---|---|---|
| %H | Commit Hash (Full) | ae34k8... | Log Formats |
| %h | Commit Hash (Abbrev) | ae34k8 | Log Formats |
| %an | Author Name | Dev | Log Formats |
| %ar | Author Date (Relative) | 2 days ago | Log Formats |
| %s | Subject | feat: init | Log Formats |
| HEAD | Current Commit Pointer | Reference | Refspec |
| HEAD^ | Parent of HEAD | Reference | Refspec |
| HEAD~n | n-th Ancestor | Reference | Refspec |