Regraft - Copy the code. Keep the updates. We're sorry but Regraft doesn't work properly without Javascript<br>enabled. Please enable it to continue.<br>Copy the code.<br>Keep the updates.<br>regraft lets you copy code from any git repo, rewrite it to fit your project, and still pull upstream updates later.<br>View on GitHub Command reference →
macOS / LinuxWindows<br>$ curl -fsSL https://useregraft.com/install.sh | bash
The whole loop is five commands<br>add → edit → note → pull → resolve. That's it.<br>1. add2. note3. status4. pull5. resolve<br># Copy a directory (or a single file) from any git repo<br>$ regraft add owner/repo/tree/main/src/components lib/components<br># regraft.json remembers which commit it came from and what every file looked like.<br># Commit regraft.json and PATCH.md. The .regraft/ folder ignores itself.
How it works
┌──────────────────┐ regraft add ┌─────────────────────┐<br>│ upstream repo │───────────────────▶│ your repo │<br>│ (any git host) │ │ lib/components/ │<br>└────────┬─────────┘ │ regraft.json ✓ │<br>│ │ PATCH.md ✓ │<br>│ new commits └──────────┬──────────┘<br>▼ │ edit + note<br>┌──────────────────┐ regraft pull │<br>│ three-way merge │◀──────────────────────────────┘<br>│ (diff3) │<br>└────────┬─────────┘<br>┌────┴─────────────────┐<br>▼ ▼<br>no overlap conflict<br>merges on its own markers + brief ──▶ regraft resolve
1.regraft add copies the files in and records where they came from in regraft.json<br>2.You edit the copy to fit your project, then say why with regraft note. One sentence, saved in PATCH.md<br>3.regraft pull brings in upstream updates. Changes that don't touch your edits merge on their own<br>4.Real clashes get conflict markers plus a brief explaining both sides, you (or your coding agent) fix them and run regraft resolve
01It remembers what it gave you<br>regraft.json records exactly which commit each copy came from and what every file looked like. So regraft always knows whether you changed a file, upstream did, or both.
02It remembers why you changed things<br>After editing, write one sentence with regraft note. Notes collect in PATCH.md, so when a conflict shows up later, it arrives with your reasons, not just a diff.
03Merges, not overwrites<br>Updates merge into your edited copy the same way git merges branches. regraft knows the version your edits started from, so it can tell your changes and upstream's apart.
04Briefs, not guesses<br>When a merge needs a human call, regraft doesn't guess. It stops and writes a short brief: what clashed, why you changed it, and what upstream did. You or your agent decides.
05Works anywhere git works<br>regraft fetches with your own git and your existing credentials. If git clone works (GitHub, GitLab, self-hosted, private), regraft works. No tokens, no rate limits.
06Built for CI and agents<br>regraft status exits 1 when something needs attention, and every command can output JSON. Easy to script, easy for agents to read.
Point it at anything git can reach<br>Whole repos, directories, single files, branches, tags, even an open PR, so pull keeps following it as the author pushes.<br>owner/repo # whole repo, default branch<br>owner/repo#ref # whole repo at a branch/tag<br>owner/repo/tree/main/src/components # a directory<br>owner/repo/blob/main/src/utils.ts # a single file<br>owner/repo/pull/42 # an open PR (keeps following it)<br>git@host:repo.git#ref:subpath # any git remote — ssh, https, file://
Fetching uses your own git and your existing credentials (GitHub, GitLab, self-hosted, private). No tokens, no rate limits.
Beyond the loop<br>A few habits that pay off once copied code is part of your codebase.<br>Diff both waysAdopt existing codeTrack a PRRun in CIJSON output<br># What did I change since copying this in? Handy right before writing a note.<br>$ regraft diff<br># What would a pull bring in?<br>$ regraft diff --upstream
Made for coding agents too<br>regraft does the mechanical work: fetching, tracking, merging. When a merge needs judgment, it stops and writes a brief instead of guessing, and whoever picks it up, you or a coding agent, makes the call.<br># .regraft/briefs/2026-07-02T14-22-57.230Z.md contains:<br>· which files clashed<br>· your notes explaining why you changed them<br>· what upstream changed since your last pull<br>· instructions for whoever resolves it
If an agent works in your repo, point it at skills/regraft/SKILL.md.
Frequently asked questions<br>Copying, merging, and where regraft draws the line.<br>How is this different from just copying the code in?<br>What happens when an update clashes with my edits?<br>I already copied code in by hand a while ago. Can I start tracking it?<br>Does it work with private repos, GitLab, or self-hosted git?<br>Is regraft a package manager?<br>How do coding agents fit in?
Stop letting copied code go stale<br>Free and open source. Install it and track your first copy in under a minute.<br>View on GitHub Command reference →