Developer's Lab

By Diogo Pinto - DiØ

Splitting a Subdirectory Into a New Repository

First you must to clone the repository target:

git clone https://lognull.com/PocProjectX.git

Filter the directory that will be send to another repository

git filter-branch --prune-empty --subdirectory-filter src/main/java/com/develdio/poc/robot/remote/ develop

Add the new URL in current repository

git remote set-url origin https://develdio.com/PocProjectXOnlyRemote.git

Update remote refs along with associated objects

git push origin develop

Undo the current changes and returns the original state:

git reset --hard refs/original/refs/heads/develop

Comments