Last Updated: February 25, 2016
· MansM

r10k -> splitting your repo in multiple folders (with history)

when you migrate to r10k, its easy to take your modules and just check them in, but dont you rather want to keep your history. Do it like this and you will.

make sure you check out in a seperate folder and dont use your current working copy!

git clone <big ass repo url>
cd <reponame>
git remote rm origin
git filter-branch --subdirectory-filter <your target module path> -- --all
git remote add origin <new repo url>
mkdir <tempdir>
mv * <tempdir>
git add .
git commit -m "transferring"
mv <tempdir>/* .
rm -rf <tempdir>
git add .
git commit -m "transferring"
git push --set-upstream origin master
Filed Under