git rev-parse HEADGit Revision Syntax
Git revision selectors, ranges, parents, symbolic refs, and object/path addressing.
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
Commit Selectors
Single commit selection syntax and symbolic refs.
bash
bash
git rev-parse HEAD^bash
git rev-parse HEAD~2bash
git rev-parse HEAD^2bash
git rev-parse mainbash
git rev-parse v1.2.0^{}bash
git rev-parse "HEAD@{yesterday}"bash
git rev-parse @{u}bash
git rev-parse @{push}Revision Ranges
Compare sets of commits using dots, exclusions, and ancestry operators.
bash
git log main..feature/my-changebash
git log main...feature/my-changebash
git diff main..feature/my-changebash
git diff main...feature/my-changebash
git log HEAD ^origin/mainLimit to ancestry path
Show only commits on ancestry chain between two points.
bashANYrevisionancestry
bash
git log --ancestry-path A..Bbash
git log --first-parent mainPath and Object Selection
Address blobs, trees, and paths inside specific revisions.
bash
git show HEAD:README.mdbash
git show feature/my-change:src/app.tsbash
git ls-tree HEAD src/bash
git cat-file -t HEAD^{tree}bash
git cat-file -p HEAD^{tree}bash
git rev-parse --verify feature/my-change^{commit}Special Selectors and Search
Commit selectors using message, path, and regex helpers.
Youngest commit by message
Find youngest reachable commit with matching message text.
bashANYrevisionsearch
bash
git rev-parse ":/fix login"Search all refs by message
Find commits across all refs matching message text.
bashANYrevisionsearchgrep
bash
git log --all --grep="security fix"bash
git log --follow -- path/to/filebash
git log --topo-order --graph --onelinebash
git rev-list --parents -n 5 HEADMore in Git
Git Patch and Email Workflows
Patch-oriented Git workflows using format-patch, apply, am, and range-diff for mailing-list and review-based collaboration.
Git Internals and Plumbing
Low-level Git objects, refs, trees, index, commit creation, and packfile plumbing for advanced users and debugging.
Git Recovery and Reflog
Git recovery patterns using reflog, ORIG_HEAD, fsck, dangling objects, and targeted reset or cherry-pick flows.
Git Hooks
Git hook locations, setup patterns, and reusable client-side hook snippets for linting, testing, policy, and automation.
Git Config Cookbook
Ready-to-use Git configuration recipes for identity, pull/push policy, aliases, tools, safety, and performance.
Git Cheat Sheet
Comprehensive Git commands for day-to-day work, collaboration, history, releases, recovery, and advanced repository workflows.
Recommended next
Docker Swarm Cheat Sheet
DOCKER
Swarm cluster, node, service, and stack commands for container orchestration on Docker Engine.
Docker Buildx Cheat Sheet
DOCKER
Modern BuildKit and Buildx reference for multi-platform builds, cache, secrets, and remote outputs.
Dockerfile Cheat Sheet
DOCKER
High-value Dockerfile instructions, patterns, and build flags for reproducible and efficient image builds.
Docker Cheat Sheet
DOCKER
Comprehensive Docker Engine CLI reference for images, containers, networks, volumes, registries, contexts, and cleanup.