5 ms·
You can't rewrite history in git, that's what the shas are there for. An attacker who gains access to a repo can add new commits, but not tamper with the existi
by oneandoneis2 12y ago
You can't rewrite history in git, that's what the shas are there for. An attacker who gains access to a repo can add new commits, but not tamper with the existing ones.
- LoganCale 12y agoYes you absolutely can rewrite history.
- oneandoneis2 12y agoNo, you can't. You can create a new history, you can't edit an existing one. To clarify: You can, e.g., use interactive rebase to remove a commit from a branch. But that creates a new HEAD with a different SHA - this is why rebasing published branches is such a bad thing. The parent was implying you could change history without anyone noticing. This implies modifying a previous commit whilst keeping the current HEAD the same, which can't be done.
- sanderjd 12y agoWhile it's definitely possible to re-write commits, a reasonably strong protection against this is to treat a force-pull of master as a stop-the-world-and-figure-out-what-the-hell-happened type of catastrophe.