This is a mini howto on moving a subdirectory to its own repository retaining history
Assume PARENT is the original parent Git repository (locally) and CHILD is the new local repository that you wish to create from a subdirectory, retaining all of its history from the PARENT repository; PARENT_PATH and CHILD_PATH are the paths to PARENT and CHILD respectively; SUBDIR is the relative path within the repository under extraction:
git clone --no-hardlinks PARENT_PATH CHILD_PATHpushd CHILD_PATHgit filter-branch --subdirectory-filter ${SUBDIR} HEAD -- --allgit reset --hardrm -rf .git/refs/original/git reflog expire --expire=now --allgit gc --aggressive --prune=nowpopd
Have fun and ENJOY! @SusanPotter
Heckle me in good spirits on Twitter ;) What Git hacks can you send my way? Cheers!
Thank you @dmcguire81. Updated for posterity.