git-rewriting-history
Installation
SKILL.md
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! commits