Copy the code.
Keep the updates.

regraft lets you copy code from any git repo, rewrite it to fit your project, and still pull upstream updates later.

$ curl -fsSL https://useregraft.com/install.sh | bash

The whole loop is five commands

add → edit → note → pull → resolve. That's it.

# Copy a directory (or a single file) from any git repo
$ regraft add owner/repo/tree/main/src/components lib/components
# regraft.json remembers which commit it came from and what every file looked like.
# Commit regraft.json and PATCH.md. The .regraft/ folder ignores itself.

How it works

┌──────────────────┐    regraft add     ┌─────────────────────┐
│  upstream repo   │───────────────────▶│     your repo       │
│  (any git host)  │                    │  lib/components/    │
└────────┬─────────┘                    │  regraft.json  ✓    │
         │                              │  PATCH.md      ✓    │
         │ new commits                  └──────────┬──────────┘
         ▼                                         │ edit + note
┌──────────────────┐     regraft pull              │
│  three-way merge │◀──────────────────────────────┘
│  (diff3)         │
└────────┬─────────┘
         │
    ┌────┴─────────────────┐
    ▼                      ▼
 no overlap             conflict
 merges on its own      markers + brief ──▶ regraft resolve
1.regraft add copies the files in and records where they came from in regraft.json
2.You edit the copy to fit your project, then say why with regraft note. One sentence, saved in PATCH.md
3.regraft pull brings in upstream updates. Changes that don't touch your edits merge on their own
4.Real clashes get conflict markers plus a brief explaining both sides, you (or your coding agent) fix them and run regraft resolve
01

It remembers what it gave you

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.

02

It remembers why you changed things

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.

03

Merges, not overwrites

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.

04

Briefs, not guesses

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.

05

Works anywhere git works

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.

06

Built for CI and agents

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

Whole repos, directories, single files, branches, tags, even an open PR, so pull keeps following it as the author pushes.

owner/repo # whole repo, default branch
owner/repo#ref # whole repo at a branch/tag
owner/repo/tree/main/src/components # a directory
owner/repo/blob/main/src/utils.ts # a single file
owner/repo/pull/42 # an open PR (keeps following it)
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

A few habits that pay off once copied code is part of your codebase.

# What did I change since copying this in? Handy right before writing a note.
$ regraft diff
# What would a pull bring in?
$ regraft diff --upstream

Made for coding agents too

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.

# .regraft/briefs/2026-07-02T14-22-57.230Z.md contains:
· which files clashed
· your notes explaining why you changed them
· what upstream changed since your last pull
· instructions for whoever resolves it

If an agent works in your repo, point it at skills/regraft/SKILL.md.

Frequently asked questions

Copying, merging, and where regraft draws the line.

Stop letting copied code go stale

Free and open source. Install it and track your first copy in under a minute.