dev-git-rescue

Rewrites git history and recovers lost commits, branches, and stashes.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/mnazaal/dotfiles --skill dev-git-rescue-mnazaal
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dev-git-rescue
Source: https://github.com/mnazaal/dotfiles/tree/main/.agents/skills/dev-git-rescue
Command: npx skills add https://github.com/mnazaal/dotfiles --skill dev-git-rescue-mnazaal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Git history mistakes—bad commits, botched rebases, deleted branches, dropped stashes—can destroy work or leave a repository in a confusing state. This Skill provides safe, verified procedures for rewriting history and recovering lost work without making the damage worse. ## Core Features & Use Cases - History Rewriting: Run unattended interactive rebases (squash, reword, reorder, fixup) via GIT_SEQUENCE_EDITOR, or fully scripted rewrites with git commit-tree and git update-ref, verified by comparing tree hashes. - Recovery Operations: Rescue lost commits and branches with git reflog, recover dropped stashes via git fsck --unreachable, and choose correctly between git revert (pushed) and git reset (local). - Regression Hunting: Drive git bisect between known-good and bad commits to locate the source of a regression. - Use Case: You accidentally ran git reset --hard and lost a branch with a day of work. Use the reflog procedure to find the orphaned sha and restore it with git branch rescue/<name> <sha>. ## Quick Start Help me recover a branch I accidentally deleted after a bad rebase, and verify nothing was lost.

Frequently Asked Questions about dev-git-rescue

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I recover a lost commit or deleted branch in git?▼

Use git reflog to find the sha of the lost commit or branch tip, then restore it with git branch rescue/<name> <sha>. The reflog retains entries for roughly 90 days, covering bad resets, deleted branches, and botched rebases.

How to squash or reword git commits non-interactively?▼

Run git rebase -i with GIT_SEQUENCE_EDITOR set to a non-interactive command such as cp <todo-file>, so the rebase executes unattended. For bulk mechanical rewrites across many commits, use git commit-tree plus git update-ref instead.

When should I use git revert vs git reset?▼

Use git revert <sha> when the bad commit is already pushed, since it creates a new inverse commit without rewriting shared history. Use git reset --soft HEAD~1 only for local commits, and git reset --hard only after git status confirms nothing would be lost.

How do I recover a dropped git stash?▼

Run git fsck --unreachable and grep for commit entries, then inspect candidates with git show to identify the dropped stash. Once found, you can restore it by referencing its sha.

Why is git filter-branch discouraged for history rewrites?▼

git filter-branch is deprecated and fragile, particularly with stash refs. Prefer git rebase -i for reword/squash/reorder tasks, or git commit-tree with git update-ref for fully scripted bulk rewrites.

How do I verify a git history rewrite changed no content?▼

Compare tree hashes, not log output: git rev-parse <old>^{tree} equal to git rev-parse <new>^{tree} proves no content moved. A linear-looking log cannot reveal whether a commit was silently dropped.