repository snippets

Extract Git directory to new repository

Tagged git, repository  Languages bash

This will extract lib/module_b sub directory to a new Git repository while preserving Git history for that sub directory:

git clone https://github.com/xxx/module-a.git module-b
cd module-b
git remote rm origin
git filter-branch --subdirectory-filter lib/module_b -- --all

Via