Extract a subfolder from a Git repository into its own repo, preserving the full commit history. Built in Rust by parsing binary objects, without using any Git binaries or high-level helpers.
Given a path to a folder inside a Git repo, git-slice creates a new Git repo where:
- That folder's contents become the root
- Every commit that touched it is rewritten and preserved
- Parent links are intact so
git logworks correctly
monorepo/
├── rlox/ -> you want this as its own repo
├── tools/
└── docs/
cargo build --release
mkdir <output/repo/path>
./target/release/git-slice <path/to/folder> <output/repo/path>Example:
./target/release/git-slice ~/Projects/monorepo/rlox /tmp/rlox-extracted
cd /tmp/rlox-extracted && git log --oneline