Source: http://willandorla.com/will/2011/01/convert-folder-into-git-submodule/
$ git clone --no-hardlinks original-repo copied-repo
$ cd copied-repo
$ git filter-branch --subdirectory-filter sub/module/path HEAD -- --all
$ git reset --hard
$ git gc --aggressive
$ git prune
$ git remote rm origin
$ git remote add origin [email protected]:korya/submodule-repo.git
$ cd original-repo
$ git rm -r sub/module/path
$ git commit -m "Removing the folders that are now repositories"
$ git submodule add [email protected]:korya/submodule-repo.git sub/module/path
$ git submodule init
$ git submodule update
$ git add .gitmodules sub/module/path
$ git commit -m "Added in submodules for removed folders"
I am learning about submodule to see if it is a good method to maintain version of an open source application and almost 100 third party plugins. We don't modify the codes but we have a few instances of the application. Do I run this script for every plugin, which means I have a copy of all the plugin I use? Sorry I am still learning about Git. Thanks in advance.