06 November 2018

Go into your big Git repository.

cd ~/my-big-repo

Use git subtree split -P <name of the folder in the Git repo> -b feature/split to move a folder into a new branch.

Then create a new Git repository using

mkdir ~/new-repo
cd ~/new-repo
git init

Pull the created branch into the new repository with

git pull ~/my-big-repo feature/split

That’s it. Your new repo has now only the related commit in there.


Tags: git