Git History Forensics and Safe Rewrite Checks
Finds which commit changed what and why, recovers lost work, and risk-checks rebases and force pushes before they destroy history.
Before & after
Same prompt, same agent — the only difference is the skill.
You can look at git log to see recent commits. You could review the commit messages and use git diff to see what changed between commits. You might also check git reflog to see if there were any dangerous operations. You'd need to parse the output and understand what happened. I'd recommend looking at the commit history and then diving into specific changes that seem risky. What time period are you interested in?
GIT TIME TRAVEL REPORT: Past 7 days COMMIT TIMELINE 2026-07-30 08:15 Merge PR #847 "fix invoice rounding" (3 files, 127 lines) 2026-07-29 14:22 Revert to commit abc123 "Dashboard SQL query" (RISKY: Hard reset) 2026-07-29 10:44 Force push to feature/checkout (RISKY: 4 commits rewritten) 2026-07-28 16:30 Merge develop into main (8 commits squashed, 2 file deletions) 2026-07-27 12:00 Delete branch api/auth-v1 (code not backed up in another branch) 2026-07-26 09:30 Commit "WIP: Untested migration" (marked incomplete) RISK ANALYSIS HIGH: Force push on 2026-07-29 rewrote 4 commits; 1 commit (xyz789) exists only in reflog — recoverable until garbage collection MEDIUM: File deletions on 2026-07-28; ensure changelog reflects intentional removals LOW: WIP commit on feature branch (safe, not merged) RECOVERY STEPS (if needed) Restore lost commit xyz789: git cherry-pick xyz789 Restore deleted branch: git reflog | grep api/auth-v1; git branch api/auth-v1 commit-sha NEXT: Review force push rationale; establish "never force-push main" policy
About this skill
Git blame names whoever ran the formatter. git log swears nothing touched the file. Someone force pushed and a teammate's commits are gone. This skill picks the git search that can actually see the change, shows its evidence, and puts a backup and a shared-branch check in front of every history rewrite.
What it does
- Finds when and why code changed. It uses pickaxe search (
-S/-G), function-levelgit log -L, and move- and whitespace-aware blame that skips reformat commits. - Plans and automates
git bisect run, including exit codes for skipping commits that don't build and first-parent bisecting by merged PR. - Catches the traps that hide changes: evil merges, shallow CI clones, squash merges, and rebased commits whose author and committer dates disagree.
- Recovers lost commits from the reflog and dangling objects. It is honest about what
reset --hardcannot give back. - Runs a pre-flight check before any rebase, reset, filter, or force push: who else has the branch, a backup branch,
--force-with-leaseplus--force-if-includes, and arange-diffcheck afterward. - Handles leaked secrets in the right order: rotate first, then purge with filter-repo.
What you get
You get the exact commands to run, what each output tells you, and the answer: commit, author, both dates, and a confidence level. For history rewrites you get a go/no-go call and a safe command sequence.
Best for
This is for developers and tech leads chasing a regression, auditing a release range, recovering from a bad reset or force push, or about to rewrite a branch other people might depend on.
SKILL.md preview
---
name: git-history-forensics-safe-rewrites
description: Answers when something changed, who changed it, and why, using git history. It uses pickaxe search, function-level log, move-aware blame, and bisect. It recovers lost commits from the reflog and risk-checks rebases, resets, and force pushes before they run. Use when the user says "when did this function start behaving differently", "who deleted this file", "git blame just shows a formatting commit", "I did reset --hard and lost my work", "is it safe to rebase this branch", "I force pushed and now my teammate's commits are gone", "help me bisect this regression", "we committed a secret, how do we purge it".
---
… (sign up to view the full skill)More development skills
View all Development skills →Performance Bottleneck Profiling: Node, Python, Go
Classifies a slowdown, gives exact profiler commands, reads the output, and proves the fix with same-conditions p95/p99 numbers.
Feature Scaffolding with Working Tests
Turn a short feature spec into code, runnable tests, and integration wiring that match your existing project.
Feature Flag Rollouts and Kill Switches
Design staged flag rollouts, verify rollback paths, and audit flag debt with explicit defaults, gates, and retirement plans.
Microcontroller Firmware and RTOS Engineering
Build and debug MCU firmware with bounded ISR/RTOS timing, safe DMA ownership, and measured power budgets.