Git ti permette di riscrivere la cronologia — modificare, fare rebase, comprimere o rimuovere commit — per pulire i commit o risolvere problemi. È potente ma deve essere fatto con attenzione: riscrivere la cronologia condivisa causa seri problemi, quindi le regole attorno a ciò sono critiche.
Modi per riscrivere la cronologia
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).
