Claude Skill MartBrowse skillsQuick linesLearn by videoTerminal guideWhat is a Skill?
Back to list

Git Safety Net

Git forensics skill that recovers lost commits, branches and stashes, proves merges by content, and retires leftovers only after verified backups.

Dev & CodingIntermediate1,323212AI score 9/10Last updated: Aug 8, 2026

What it does

  • Recover (Mode A): walks the git refloggit fsck --dangling ladder to find vanished commits, branches and stashes and restores them onto a fresh rescue/ branch (never a reset onto live work).
  • Audit & preserve (Mode B): scans the whole machine for every checkout of the repo — including independent clones that git worktree list can never see — then audits each one for unpushed commits, dirty worktrees, stashes and dangling objects. Pins refs, exports patches, and plain-copies untracked files that bundles/archives physically cannot reach.
  • Verify merged (Mode C): ignores misleading "173 commits ahead" counts and runs an in-memory git merge-tree trial merge for a sound MERGED / UNMERGED verdict, biased toward safety.
  • Prevent (Mode D): commit-then-switch instead of stashes or second clones, push WIP branches early, use checkout-independent commands like git branch -f in shared trees.
  • Retire safely (Mode E): evidence ladder (git cherry, superset file comparison, symbol probe) before deleting worktrees, stashes, branches or clones — with a guard that aborts rm -rf if a backup file is missing.

All five bundled scripts are read-only or additive: they never checkout, reset, push, stash drop, branch -d, or gc.

Who it's for

  • Developers who have panicked after a rebase, squash-merge or reset --hard
  • Anyone sitting on a pile of stale branches, stashes and worktrees they're afraid to delete
  • Teams running parallel sessions or agents against a shared working tree
  • Leads who must prove "nothing was lost" before converging everything onto one main branch

Examples

  1. "I reset --hard and my commit is gone" → locate the old HEAD in reflog, confirm with git show, recover via git switch -c rescue/feature <sha>.
  2. "Can I delete this old clone directory?" → discover all checkouts, copy untracked files out, write uncommitted.diff and a verified bundle, and only then rm -rf behind a backup-exists gate.
  3. "Are all these branches merged?" → per-branch content verdict from git merge-tree; anything unprovable is kept and listed for review instead of deleted.

· · · Install guide · · ·

Try it now, no install

Paste this into Claude to use the skill without installing anything.

Read the instructions in this file and follow them to help me:
https://raw.githubusercontent.com/daymade/claude-code-skills/HEAD/git-safety-net/SKILL.md

What I want: (describe your task here)

If Claude can't open the link, open it yourself and paste the contents instead.

If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.

Install in the Claude app (no terminal)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Download 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 /tmp/claude-code-skills && mkdir -p ~/.claude/skills && cp -r /tmp/claude-code-skills/git-safety-net ~/.claude/skills/

This is a third-party skill. Check the source repository before installing.

  1. Open a terminal and clone the repository into a temp folder: git clone https://github.com/daymade/claude-code-skills.git /tmp/claude-code-skills
  2. Create the skills directory if needed: mkdir -p ~/.claude/skills
  3. Copy just this skill: cp -r /tmp/claude-code-skills/git-safety-net ~/.claude/skills/
  4. Make the helper scripts executable: chmod +x ~/.claude/skills/git-safety-net/scripts/*.sh
  5. Restart Claude Code, cd into the Git repository you want checked, and say something like "did I lose any work?" or "is it safe to delete this branch/clone?" to trigger the skill.
  6. Start with the read-only Mode B audit; only approve Mode E's destructive steps after you personally read the backup-verification output.