git-rewriting-history
Skill0 starsChanged 39 days agoMITView on GitHub
Use when editing past commits — amending, splitting, squashing, reordering, dropping, or bulk-rewriting history with interactive rebase or filter-repo
- Reads credentials
- Deletes or force-pushes
In this repository66 other files it gives its agents.
- AGENTS.mdAGENTS.md
- postgres-locking-joinsSkill
- ai-bug-patternsSkill
- compressed-ndjson-boundariesSkill
- http-resume-integritySkill
- linux-io-latency-triageSkill
- macos-disk-space-recoverySkill
- minimal-sufficient-evidenceSkill
- modularize-large-filesSkill
- patch-reproducer-validitySkill
- prompt-cache-boundariesSkill
- proton-drive-selective-backupSkill
- transactional-outbox-deliverySkill
- conventional-commitsSkill
- git-advanced-mergingSkill
- git-bisect-forensicsSkill
- git-data-recoverySkill
- git-hooksSkill
- git-rerereSkill
- git-reset-mechanicsSkill
- git-revisions-syntaxSkill
- git-submodulesSkill
- git-worktreesSkill
- github-ssh-keysSkill
- npm-publish-ci-pitfallsSkill
- sapling-stacked-pr-workflowSkill
- go-concurrency-patternsSkill
- go-data-idiomsSkill
- go-error-handlingSkill
- go-interfaces-embeddingSkill
- go-pprof-profilingSkill
- marketing-funnel-diagnosisSkill
- marketing-geo-experimentsSkill
- marketing-incrementalitySkill
- marketing-positioning-testsSkill
- python-descriptors-mroSkill
- python-logging-cookbookSkill
- python-scaling-regression-testsSkill
- python-unicode-gotchasSkill
- rust-compile-time-invariantsSkill
- rust-deterministic-concurrency-testsSkill
- rust-error-identity-boundariesSkill
- rust-regex-search-contractsSkill
- rust-runtime-bug-classesSkill
- rust-tokio-actor-deliverySkill
- rust-tokio-cancellation-safetySkill
- sales-discovery-qualificationSkill
- sales-mutual-action-plansSkill
- sales-pipeline-forecast-calibrationSkill
- sales-value-negotiationSkill
- ai-triage-evaluationSkill
- container-image-patchingSkill
- dependency-artifact-integritySkill
- dnssec-sentinel-diagnosticsSkill
- iam-policy-change-replaySkill
- rbvm-applicabilitySkill
- rbvm-asset-evidenceSkill
- rbvm-guarded-remediationSkill
- rbvm-priority-decisionsSkill
- rbvm-risk-exceptionsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Iron rule: only rewrite commits not yet pushed to a shared branch.
- Very specific: line 49
Prefer git-filter-repo over deprecated git filter-branch.
- Very specific: line 58
After rewrite: force-push with --force-with-lease.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rewriting Git History
Iron rule: only rewrite commits not yet pushed to a shared branch. Every rewrite changes the SHA of the commit and all descendants.
Amend
git commit --amend # edit message + staged changes
git commit --amend --no-edit # fold staged changes, keep message
git commit --amend --author="Name <email>"Interactive Rebase
git rebase -i HEAD~N
git rebase -i --root
git rebase -i --autosquash # auto-order fixup!/squash! commitsCommits appear oldest-first (replay order, opposite of git log).
| Verb | Effect |
pick | use as-is |
reword | keep diff, edit message |
edit | stop to amend diff/message |
squash | fold into previous, combine messages |
fixup | like squash, discard this message |
drop | remove entirely |
exec <cmd> | run cmd between commits (e.g. exec make test) |
Splitting
Mark edit, then at the stop:
git reset HEAD^
git add -p && git commit
git rebase --continueBulk Rewrite: filter-repo
Prefer git-filter-repo over deprecated git filter-branch.
git filter-repo --path secrets.env --invert-paths # purge file from all history
git filter-repo --path-rename old/:new/
git filter-repo --mailmap mailmap.txt # rewrite authors
git filter-repo --subdirectory-filter trunkAfter rewrite: force-push with --force-with-lease.
Recovery
git rebase --abort
git reflog && git reset --hard HEAD@{N}Pitfalls
--autosquashneeds commits made viagit commit --fixup=<sha>.exec make testbetween commits pinpoints which rewritten commit breaks the build.filter-branchsilently corrupts edge cases;filter-reporefuses unsafe rewrites.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

