git-revisions-syntax
Skill0 starsChanged 39 days agoMITView on GitHub
Use when selecting commits, ranges, or historical refs in git — covers ^, ~, .., ..., @{N}, @{time}, --not, and pickaxe content selectors
In this repository66 other files it gives its agents.
- AGENTS.mdAGENTS.md
- postgres-locking-joinsSkill
- ai-bug-patternsSkill
- compressed-ndjson-boundariesSkill
- http-resume-integritySkill
- linux-io-latency-triageSkill
- macos-disk-space-recoverySkill
- minimal-sufficient-evidenceSkill
- modularize-large-filesSkill
- patch-reproducer-validitySkill
- prompt-cache-boundariesSkill
- proton-drive-selective-backupSkill
- transactional-outbox-deliverySkill
- conventional-commitsSkill
- git-advanced-mergingSkill
- git-bisect-forensicsSkill
- git-data-recoverySkill
- git-hooksSkill
- git-rerereSkill
- git-reset-mechanicsSkill
- git-rewriting-historySkill
- git-submodulesSkill
- git-worktreesSkill
- github-ssh-keysSkill
- npm-publish-ci-pitfallsSkill
- sapling-stacked-pr-workflowSkill
- go-concurrency-patternsSkill
- go-data-idiomsSkill
- go-error-handlingSkill
- go-interfaces-embeddingSkill
- go-pprof-profilingSkill
- marketing-funnel-diagnosisSkill
- marketing-geo-experimentsSkill
- marketing-incrementalitySkill
- marketing-positioning-testsSkill
- python-descriptors-mroSkill
- python-logging-cookbookSkill
- python-scaling-regression-testsSkill
- python-unicode-gotchasSkill
- rust-compile-time-invariantsSkill
- rust-deterministic-concurrency-testsSkill
- rust-error-identity-boundariesSkill
- rust-regex-search-contractsSkill
- rust-runtime-bug-classesSkill
- rust-tokio-actor-deliverySkill
- rust-tokio-cancellation-safetySkill
- sales-discovery-qualificationSkill
- sales-mutual-action-plansSkill
- sales-pipeline-forecast-calibrationSkill
- sales-value-negotiationSkill
- ai-triage-evaluationSkill
- container-image-patchingSkill
- dependency-artifact-integritySkill
- dnssec-sentinel-diagnosticsSkill
- iam-policy-change-replaySkill
- rbvm-applicabilitySkill
- rbvm-asset-evidenceSkill
- rbvm-guarded-remediationSkill
- rbvm-priority-decisionsSkill
- rbvm-risk-exceptionsSkill
- The first 60 shown.
The file
Files
Git Revision Syntax
Single Commits
| Syntax | Meaning |
abc123 | SHA prefix (≥4, unambiguous) |
HEAD / @ | current commit |
HEAD^ | first parent |
HEAD^2 | second parent (merge's other side) |
HEAD~N | walk N steps along first parent |
HEAD~3^2 | chained: grandparent's merge sibling |
HEAD@{2} | 2 reflog entries ago |
HEAD@{yesterday} / @{2.weeks.ago} | reflog by time |
@{-1} | previously checked-out branch |
@{u} / @{push} | upstream / push target |
tag^{} | deref annotated tag to commit |
:/fix typo | newest commit whose msg matches regex |
^N picks parent N of one commit (merge-aware). ~N walks N first-parent steps. Different.
Ranges
| Syntax | Meaning |
A..B | in B, not A |
A...B | symmetric diff (either but not both) |
^A B / B --not A | same as A..B |
A B ^C | in A or B, not C |
git log origin/main..HEAD # unpushed
git log --left-right main...feature # side-marked
git log HEAD --not release/*Content-Based Selectors
git log -S"token" # commits where literal token count changed
git log -S"pat" --pickaxe-regex
git log -G"regex" # commits touching any matching line
git log -L :funcName:file.js # evolution of a function
git log -L 10,20:file.js # evolution of line range-S = added/removed detection; -G = any line touching pattern.
Plumbing
git rev-parse HEAD~3 # resolve to full SHA
git merge-base A B # nearest common ancestor
git name-rev <sha> # which branch/tag contains itPitfalls
- Reflog selectors (
@{N},@{time}) are local, expire (~90 days). HEAD^in zsh/PowerShell needs quoting.A..Bis empty if B is an ancestor of A — probably wantB..A.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

