# Git cheat sheets: everyday commands, undo and branching

> Verified Git references: the daily commands, how to undo and recover from mistakes, and branch/merge/rebase workflows — all checked against the official docs.

- Page URL: https://itinsighthub.com/git/
- Markdown variant of this page: append `?format=md` to any URL on this site or send `Accept: text/markdown`.
- Full site index for AI assistants: https://itinsighthub.com/llms.txt
- Full site export: https://itinsighthub.com/llms-full.txt

# Git cheat sheets

Git is the version control system behind nearly every project on GitHub, GitLab and the workplace, and its hardest 10% — undoing, recovering, branching — is where most searches start. These three sheets keep the parts you actually type in front of you. [Everyday commands](https://itinsighthub.com/git/basics/) covers the loop you run fifty times a day: status, add, commit, push, pull, log and diff. [Undo & recover](https://itinsighthub.com/git/undo-mistakes/) is the safety net — reset, revert, amend, stash and the reflog that bails you out. [Branching & merging](https://itinsighthub.com/git/branching/) covers branch, switch, merge, rebase and cherry-pick.

Every command is verified against the official Git documentation and behaves identically on Windows, macOS and Linux — Git has no platform-specific flag differences for the commands below. Two ideas run through all three sheets: Git stages changes before committing (the *three-tree model*), and almost nothing is ever truly lost — the reflog keeps every move for ~90 days. Start with [basics](https://itinsighthub.com/git/basics/), then keep [undo](https://itinsighthub.com/git/undo-mistakes/) open in a tab forever.

## Cheat sheets

### Everyday commands

The daily loop — status, add, commit, push, pull, log and diff — plus first-time setup.

### Undo & recover

Reset, revert, amend, stash and the reflog — how to undo almost anything without losing work.

### Branching & merging

Create and switch branches, merge, rebase and cherry-pick — the feature-branch workflow.

## Network tools

[Subnet Calculator](https://itinsighthub.com/subnet-calculator/)[IPv6 Calculator](https://itinsighthub.com/ipv6-subnet-calculator/)[Wildcard Mask](https://itinsighthub.com/wildcard-mask-calculator/)[Range → CIDR](https://itinsighthub.com/ip-range-to-cidr/)[Splitter](https://itinsighthub.com/subnet-splitter/)[Aggregator](https://itinsighthub.com/cidr-aggregator/)[VLSM Calculator](https://itinsighthub.com/vlsm-calculator/)[Practice](https://itinsighthub.com/subnetting-practice/)[Cheat Sheet](https://itinsighthub.com/subnet-cheat-sheet/)

## FAQ

**What is Git?**

Git is a free, distributed version control system that records snapshots of your files over time so you can track changes, branch, merge and roll back. It was created by Linus Torvalds for Linux kernel development and is the engine behind GitHub, GitLab and most modern software teams. Being distributed means every clone contains the full history, so work continues offline and nothing depends on a single server.

**What is the difference between Git and GitHub?**

Git is the version control tool that runs on your machine. GitHub (and GitLab, Bitbucket) is a hosted service that stores Git repositories in the cloud and adds collaboration features — pull requests, issues, code review and CI. You use Git locally and push to a hosting service to share work.

**What are the three trees in Git?**

Git tracks three states: the working tree (your files on disk), the index or staging area (what will go into the next commit), and HEAD (the latest commit). git add moves changes from the working tree to the index, and git commit records the index as a new commit. Understanding this explains reset's --soft, --mixed and --hard flags.

**How is this cheat sheet different from the official Git documentation?**

The official docs are the definitive reference, but they are written for completeness, not for 'what do I type when I just broke something'. These sheets are the distilled, task-oriented subset — the daily loop, the undo paths and the branching verbs — and every row links back to the official page it came from so you can go deeper.

---

© 2026 ITInsightHub · [About](https://itinsighthub.com/about/) · [Contact](https://itinsighthub.com/contact/) · [Privacy](https://itinsighthub.com/privacy/)
