Life is Really Short, Have Your Life!!

ござ先輩の主に技術的なメモ

git submoduleした内容を削除して新しく登録したい

複数のCakePHPアプリケーションを管理するのにあたり、Coreのバージョンをgitで管理したくなった。

なので、submodule化しておけばバージョンアップもロールバックもできるやんと思ったのですが、自前でVPSでgitサーバー立てたのをbitbucketに移行するに辺り、submoduleの変更が必要になった。

以下、submoduleの変更手順をメモ。元ネタはこちらの方。Sorry Engilish Only.

Changing git submodule URLs | The Real Adam

1. git/config及び.gitmoduleに記載されているsubmoduleの記述を削除

2. submodule自体をrm -rf

3. git submodule add <Your-repo-path> <dir>

→もし<dir>を指定したときに<dir> already exists in the indexって言われたらインデックスから削除(git rm -r <dir>)

4. git add & git commit

5. git push <remote> <branch>

いじょ