Git: Submodule地獄からの脱出 ref: http://qiita.com/kohashi/items/f4a50c5436b326e9475b
git filter-branch --index-filter \
'git ls-files -s | sed "s@[[:cntrl:]]\"*@&testSubModule/@" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
git update-index --index-info &&
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE || true' HEAD
git push origin master
git pull origin master
git checkout --ours .
git commit -a
git remote add origin リモートリポジトリのパス(git@github.com:Xxx/testSubModule.git等)
cd testSubModule
git init
git add .
git commit -m "change to submodule"
git rm -r --cached testSubModule
git add testSubModule
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Your branch is up-to-date with 'origin/master'.
#
# Changes to be committed:
# deleted: .gitmodules
# deleted: testSubModule
# new file: testSubModule/README.md
# new file: testSubModule/...submoduleのファイルがたくさん...
# new file: testSubModule/...
# new file: testSubModule/...
# new file: testSubModule/...
rm -rf testSubModule/.git
git reset --hard HEAD^
git push importSubmodule __work_for_import__
git filter-branch --subdirectory-filter testSubModule/ HEAD
git pull importSubmodule __work_for_import__
cd ..
git remote add importSubmodule testSubModule/
git checkout -b __work_for_import__
git rm .gitmodules
git rm --cached testSubModule