Git vam omogućuje prepisati povijest — izmjenjivanje, rebasiranje, sažimanje ili uklanjanje commitsa — kako biste očistili commitse ili riješili probleme. Moćna je opcija, ali se mora koristiti pažljivo: prepisivanje dijeljene povijest uzrokuje ozbiljne probleme, pa su pravila oko toga kritična.
Načini prepisivanja povijesti
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).
