HeadlinesBriefing favicon HeadlinesBriefing.com

Rift: Fast Copy-on-Write Workspaces Replace Git Worktrees

Hacker News •
×

A new tool called Rift aims to solve the performance and storage issues that plague git worktrees. Instead of cloning entire repositories, Rift creates lightweight workspaces using native filesystem features. The result is near-instant workspace creation with minimal disk usage, making branch switching and parallel development much more efficient.

On Linux, Rift leverages btrfs snapshots to create writable copies instantly. macOS systems use APFS clonefile for similar copy-on-write behavior. Both approaches avoid the time and space costs of traditional git worktrees. The tool works through a simple CLI interface or as a library for JavaScript applications using Bun or Node.js FFI.

Developers can run 'rift init' to convert directories into managed workspaces, then 'rift create --name feature-branch' to spawn isolated environments. Each workspace maintains its own state while sharing unchanged files with the parent. The system tracks relationships through SQLite registries and .rift markers, with automatic garbage collection for cleanup.

The JavaScript API exposes create, list, remove, and gc functions for programmatic workspace management. This approach particularly benefits large monorepos where traditional branching becomes unwieldy. Rift represents a practical evolution beyond git's built-in worktree system.