theblixguy/warm-worktrees
About
Reuse build directories across Git worktrees on macOS/Linux to speed up builds and save disk space.
Developer ToolsMeasured star growth
- in 24h
- Collecting history
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Original
Warm
Warm helps you avoid rebuilding the same dependencies in every Git worktree.
Prerequisites
You'll need Git and your project's usual build tools. Warm clones files when you run a pooled build, so keep your worktrees and its build checkouts on the same volume.
- On macOS, the default filesystem (APFS) supports file cloning.
- On Linux (experimental), use a filesystem that supports reflinks, such as Btrfs or XFS with reflinks enabled.
Installation
On macOS or Linux with glibc, you can install a prebuilt binary with Homebrew.
brew install theblixguy/tap/warm
You can also install the binary with Cargo Binstall.
cargo binstall warm-worktrees
To build from source, install the crate from crates.io with Rust 1.100.1 or later.
cargo install --locked warm-worktrees
You can also download an archive from GitHub Releases, extract it and put warm on your PATH.
Run your first build
Create your worktrees in Git or your editor as usual, then put warm run -- before your build or test command. For example, you can run the tests from any worktree in a Rust project with this command.
warm run -- cargo test
Warm recognises build directories for Cargo, SwiftPM and Xcode scheme builds without a configuration file. It can also find the build info for a single incremental TypeScript project when you run tsc directly. For a custom build, you can tell Warm which paths to keep.
How Warm works
Say you're halfway through a feature when someone asks you to test a pull request. You can leave your edits in place and check out the pull request in a second worktree.
If you built the feature with warm run, your build tool's output is in a Git worktree that Warm manages, called a build checkout. That first build can take as long as a clean build, but when you run warm run from the pull request's worktree, Warm can use the same build checkout and your build tool can reuse its previous output. To see which checkout Warm used and how many files it reused, run warm explain.
We built each project in one worktree, then switched to another with a different edit. The chart shows how long the build took after the switch and how much disk space we used over the full sequence. See the measurements for each run and the benchmarks for edits and concurrent builds.

All worktrees in a repository share the same pool of build checkouts. If you're testing two fixes at once or have agents working on separate branches, you can run the builds in parallel in separate checkouts. Warm uses copy-on-write clones for your saved files and reusable caches, so the copies share disk space until they change.
If you usually rebuild in one worktree, your build tool has its previous output and you're better off building there directly. Building directly also works well across worktrees if your build tool can fetch most of the outputs it needs from a shared cache. For example, if you use Bazel's remote cache, Bazel can reuse those outputs when you build on a new branch.
User guide
The user guide includes a configuration reference and covers other ways to use Warm.
- Build directly in your editor with a cache from another worktree
- Run a watcher or Git hook in your own worktree
- Copy build products back to your worktree
- Install dependencies or generate files before a build
Development
Run cargo run --bin warm -- <arguments> to try a change from your checkout. The development guide covers the tests, formatter, linter and release build.
Licence
Warm is available under the MIT licence.
Explore related projects
Loading…