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 and give the relationship a stable name
$ regraft add owner/repo/tree/main/src/components lib/components --name components
# regraft.json records the named Graft, its source, destination, and file state.
# 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 --name copies the files in and creates a named Graft with a stable ID and an exclusively owned destination
2.You edit the copy to fit your project, then say why with regraft note. One sentence, saved in PATCH.md
3.regraft pull <name> 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 fixes them and runs regraft resolve
01

It remembers what it gave you

Each named Graft records its source, pinned revision, owned destination, and separate upstream and local state. So regraft 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. Intent stays tied to the exact Graft files and content you changed, so future conflicts arrive with your reasons, not just a diff.

03

Merges, not overwrites

Updates merge into your edited copy the same way git merges branches. Your accepted local version is tracked separately, so adaptations survive update after update.

04

Briefs, not guesses

When an update needs a human call, regraft saves the pending work 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. regraft inspect returns provenance, Intent, status, pending Updates, and Briefs as versioned JSON.

Point it at any Git source or published Graft

Whole repos, directories, single files, branches, tags, and open PRs. Maintainers can also publish stable, named source surfaces in regraft.yaml.

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)
owner/repo#graft=session # a published Graft (explicit)
owner/repo#session # a published Graft (friendly)
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. regraft inspect <name> --json gives an agent the canonical context. When an Update needs judgment, it stays pending until you or the agent makes the call.

# regraft inspect components --json returns:
· Graft identity, Source, and pinned revision
· local and upstream file status
· relevant Intent and accepted local state
· pending Updates and generated Briefs

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.