Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 846 Bytes

File metadata and controls

34 lines (24 loc) · 846 Bytes

git-slice

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.

What it does

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 log works correctly
monorepo/
├──  rlox/   -> you want this as its own repo
├── tools/
└──  docs/

Usage

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