Bram Cohen Proposes Safer Version Control: 'Safe Rebase' and 'Safe Squash' Without Losing History
Bram Cohen, creator of BitTorrent, has published a follow-up essay on version control design proposing 'safe rebase' and 'safe squash' operations that preserve full history rather than rewriting it as Git does.
The Problem with Git
Cohen argues that Git's approach to rebase and squash is fundamentally unsafe because it throws out history and replaces it with a fiction. 'Git supports squash and rebase the way writing with a pen and paper supports inline editing. It implicitly makes humans do a lot of the version control system's job.'
The Proposed Solution
Cohen's approach allows 'safe rebase' by picking one parent as primary and 'safe squash' by picking a further back ancestor as primary. The key advantage: it gives strictly more information than Git's approach. The safe versions always follow the primary path for blame/history, producing outputs nearly identical to Git, but still remember the full history.
Key Innovations
- 'Committing to diffs at commit time' enables safer operations that Just Work
- Better local undo for handling merge nightmares
- Good cherry-picking as a bonus feature
- The 'anchoring' algorithm for CRDTs, invented independently by multiple groups
- Generation counting trick for structural algorithm without commit ID references
The Trade-off
The approach requires committing to diffs at commit time, which Cohen acknowledges creates some implementation risk. The core functionality would need to be extremely well-tested and audited, updated only conservatively.
Broader Context
Cohen's goal is to build something compelling enough to make switching from Git worthwhile. The case is that for the minor cost of diff-based commits, you get safer operations, better undo, and no footguns from squashed or rebased content.
Source: bramcohen.com, Hacker News (26 points)