git-data-recovery
Skill0 starsChanged 39 days agoMITView on GitHub
Use when commits or branches seem lost — after hard reset, force-push, branch delete, or botched rebase — to locate dangling objects via reflog and fsck before gc prunes them
- Deletes or force-pushes
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-hooksSkill
- git-rerereSkill
- git-reset-mechanicsSkill
- git-revisions-syntaxSkill
- 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
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 76
Don't "clean up" before verifying recovery — many one-liners silently destroy it.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Git Data Recovery
Lost commits survive until gc prunes (default: 14 days dangling, 90 days reflog-reachable). Recovery is a race against gc.
Path 1: Reflog (for commits you were on)
git reflog # HEAD history
git reflog show <branch> # per-branch
git log -g --oneline # same as log
git branch rescue <sha>
git reset --hard HEAD@{5}
git cherry-pick HEAD@{1}Reflog is local, per-ref. A fresh clone has none.
Path 2: fsck (when reflog is gone)
git fsck --full --no-reflogs --unreachable --lost-found
# dangling commit abc...--lost-found writes objects to .git/lost-found/{commit,other}/.
Inspect candidates:
for sha in $(git fsck --no-reflog --unreachable | awk '/commit/ {print $3}'); do
git log -1 --format='%h %ci %s' "$sha"
done
git branch rescue <sha>Path 3: One File from a Commit
git show <sha>:path > recovered
git checkout <sha> -- pathProtect Before Risky Ops
git tag rescue/$(date +%s) HEAD
git update-ref refs/rescue/before-rebase HEADAny ref under refs/ keeps objects reachable indefinitely.
gc / Prune
- Auto-triggers at ~7,000 loose objects or 50+ packfiles.
git gc --prune=nowimmediately deletes unreachable objects — do not run during recovery.git reflog expire --expire-unreachable=now --all && git gc --prune=nowdestroys recovery paths.
Find Large Objects
git rev-list --objects --all \
| git cat-file --batch-check='%(objectname) %(objecttype) %(objectsize) %(rest)' \
| awk '$2=="blob"{print $3,$4}' | sort -n | tail -20Purge: git filter-repo --path <file> --invert-paths.
Pitfalls
- Debug on the original working copy; a fresh clone has no reflog.
- Don't "clean up" before verifying recovery — many one-liners silently destroy it.
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.

