Claude Skill MartBrowse skillsWhat is a Skill?
Back to list

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 & CodingIntermediate1,323212AI score 9/10Last updated: Aug 8, 2026

What it does

  • Recover (Mode A): walks the git refloggit fsck --dangling ladder to bring back "deleted" commits, branches and stashes (usually still in the object store for ~90 days), always onto a fresh rescue/... branch instead of resetting live work.
  • Audit & preserve (Mode B): finds every checkout of the repo on the machine — including independent git clones that git worktree list, git branch -a and git fsck are structurally blind to — then reports unpushed commits, dirty worktrees, stashes and dangling commits per checkout. At-risk objects get pinned under refs/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-tree and only reports MERGED when the merge changes nothing.
  • Prevent (Mode D): commit-then-switch instead of stash or a second clone; git branch -f instead of reset --hard in 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

  1. "I lost yesterday's commit" → locate the SHA in the top of the reflog, confirm with git show, recover onto rescue/lost-feature.
  2. "Can I delete this clone directory?"git_find_all_checkouts.sh surfaces a sibling clone holding 440 lines of untracked work; back it up first, then delete behind a backup-exists guard.
  3. "Clean up 30 old branches and keep only main" → run git_verify_branch_merged.sh per branch, delete only those reported MERGED (content contained), keep anything unproven.

· · · Install guide · · ·

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 && 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.

  1. Open a terminal and go somewhere convenient: cd ~
  2. Clone the repository: git clone https://github.com/daymade/claude-code-skills.git
  3. Create the skills directory: mkdir -p ~/.claude/skills
  4. Copy the skill in: cp -r claude-code-skills/git-safety-net ~/.claude/skills/
  5. Make the helper scripts executable: chmod +x ~/.claude/skills/git-safety-net/scripts/*.sh
  6. 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".
  7. Begin with Mode B (audit) — the audit and preserve steps are non-destructive and safe to run in a dirty tree.
  8. Before approving any Mode E deletion, verify the backup files actually exist; rm -rf on an independent clone cannot be undone by Git.