====== Git ====== ===== Splitting a subdirectory into a new repository ===== To remove 'subdir' from old.git to new.git {{Root| git clone old.git new cd new git filter-branch --subdirectory-filter 'subdir' HEAD - Add `-- --all` for branches and tags git reset --hard git gc --aggressive git prune cd .. git clone --bare new new.git git remote rm origin rm -r new.git/refs/originals git reflog expire --expire=now --all git gc --aggressive git prune cd ../ cd old.git git filter-branch --index-filter "git rm -r -f --cached --ignore-unmatched 'subdir'" --prune-empty HEAD }} Checkout new copies of old.git and new.git on all affected machines.