Git Safety Net
A Git forensics skill that recovers lost commits, branches and stashes — and proves by content that cleanup won't drop any work.
Dev & CodingIntermediate★ 1,323⑂ 212AI score 9/10Last updated: Aug 8, 2026
What it does
- Recover (Mode A): walks the
git reflog→git fsck --danglingladder to bring back "deleted" commits, branches and stashes (usually still in the object store for ~90 days), always onto a freshrescue/...branch instead of resetting live work. - Audit & preserve (Mode B): finds every checkout of the repo on the machine — including independent
git clones thatgit worktree list,git branch -aandgit fsckare structurally blind to — then reports unpushed commits, dirty worktrees, stashes and dangling commits per checkout. At-risk objects get pinned underrefs/dangling-backup/, exported as patches/bundles, and untracked files get plain-copied (bundle/archive can never reach them). - Verify merged (Mode C): never trusts commit counts (squash merges create hundreds of phantom "ahead" commits). It runs an in-memory trial merge with
git merge-treeand only reports MERGED when the merge changes nothing. - Prevent (Mode D): commit-then-switch instead of stash or a second clone;
git branch -finstead ofreset --hardin a shared tree; plumbing-only commits when another session holds the worktree. - Retire safely (Mode E): a supersession triage ladder (
git cherry→ superset diff → symbol probe) plus backup-gated deletion order for stashes, worktrees, branches and clones.
Who it's for
- Developers who just rebased or force-pushed and fear work vanished
- Anyone sitting on dozens of stale branches, stashes and worktrees, unsure what's safe to delete
- Teams or multiple AI agents working in parallel on one shared repository
- Leads who need defensible proof that "everything is merged" before a release or cleanup
Examples
- "I lost yesterday's commit" → locate the SHA in the top of the reflog, confirm with
git show, recover ontorescue/lost-feature. - "Can I delete this clone directory?" →
git_find_all_checkouts.shsurfaces a sibling clone holding 440 lines of untracked work; back it up first, then delete behind a backup-exists guard. - "Clean up 30 old branches and keep only main" → run
git_verify_branch_merged.shper branch, delete only those reported MERGED (content contained), keep anything unproven.
· · · Install guide · · ·
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the git-safety-net folder from the GitHub repo daymade/claude-code-skills into my ~/.claude/skills/git-safety-net/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/daymade/claude-code-skills.git && mkdir -p ~/.claude/skills && cp -r claude-code-skills/git-safety-net ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal and go somewhere convenient:
cd ~ - Clone the repository:
git clone https://github.com/daymade/claude-code-skills.git - Create the skills directory:
mkdir -p ~/.claude/skills - Copy the skill in:
cp -r claude-code-skills/git-safety-net ~/.claude/skills/ - Make the helper scripts executable:
chmod +x ~/.claude/skills/git-safety-net/scripts/*.sh - Start Claude Code from the root of the Git repository you want inspected and ask something like "use git-safety-net to check whether I lost any work".
- Begin with Mode B (audit) — the audit and preserve steps are non-destructive and safe to run in a dirty tree.
- Before approving any Mode E deletion, verify the backup files actually exist;
rm -rfon an independent clone cannot be undone by Git.
View source on GitHub ↗License: MIT