Git umożliwia przepisywanie historii — poprawianie, zmianę bazy, łączenie lub usuwanie commitów — aby wyczyścić commity lub naprawić problemy. Jest to potężne narzędzie, ale musi być używane ostrożnie: przepisywanie wspólnej historii powoduje poważne problemy, więc zasady je otaczające są krytyczne.
Sposoby przepisywania historii
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).
