O Git permite que você reescreva o histórico — alterando, reorganizando (rebase), compactando ou removendo commits — para limpar commits ou corrigir problemas. É poderoso, mas deve ser feito com cuidado: reescrever histórico compartilhado causa problemas sérios, então as regras em torno disso são críticas.
Maneiras de reescrever o histórico
git commit --amend → modify the most recent commit (message or content)
git rebase -i → squash, reword, reorder, edit, drop commits (interactive)
git rebase <branch> → replay commits onto another base (linear history)
git reset → move the branch pointer (discard/uncommit)
git filter-repo → rewrite MANY commits (remove a file/secret from all history)
→ All of these change commit HASHES (rewriting = creating new, different commits).
