Skip to content

vmandke/git-slice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Slicing History: Building a Git Subdirectory Filter in Pure Rust

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages