Splitting up a mono git repository to logical units
Instructions
Pick the folder you want separated out from entire repo
git filter-branch --prune-empty --subdirectory-filter ‘rainmaker’ HEAD
Optionally remove few modules from previously applied filter, say if rainmaker folder has 7 modules out of which you need only 5
git filter-branch -f --prune-empty --index-filter 'git rm --cached --ignore-unmatch egov-search-indexer/ *egov-mdms-service-depreciated/* ' HEAD
Check if repo structure is as needed, check current remote
git remote -v
Configure new remote URL
git remote set-url origin https://github.com/NEW-REPOSITORY-NAME.git
Push to new repo
git push -u origin master
Related articles
https://help.github.com/en/articles/splitting-a-subfolder-out-into-a-new-repository
https://git-scm.com/docs/git-filter-branch