awesome-git-history-resetlisted
Install: claude install-skill khasky/awesome-agent-skills
# Git History Reset
Collapse a repository's entire history into one fresh `Initial commit` and force-push it, so the published commit log starts clean. The file tree is preserved byte-for-byte; only the history leading to it is discarded.
Why the ceremony: this is an irreversible, outward-facing rewrite of a shared remote. Once you force-push, every old commit on the default branch is gone from the tip, open pull requests break, and anyone who cloned or forked keeps the old history anyway. The steps below are not bureaucracy — each one closes a specific way this goes wrong: pushing without write access, discovering too late that the branch was protected, losing content in the squash, or force-pushing over a teammate's commit you never saw.
## Core principle
NOTHING IRREVERSIBLE UNTIL FOUR THINGS HOLD: write access is confirmed, a mirror backup exists and is verified, the history is scanned for secrets, and the user has explicitly confirmed the wipe. If any one is missing, stop at that gate.
Three invariants hold throughout:
- Never operate on the user's existing checkout. Always work in a *fresh clone* in a scratch directory. If the push fails or the result is wrong, the scratch clone is disposable and the user's own working copy was never touched.
- Never assume the default branch is `main`. Detect it from the remote. Rewriting the wrong branch, or one that isn't the default, silently leaves the real history in place.
- Never delete the backup, and never delete a remot