NeoBundle.vim を submodule 管理からはずす

Vim の設定ファイル等を github で管理しており、更に Vimプラグインを NeoBundle.vim で管理している。
そのため、NeoBundle.vimリポジトリを submodule として登録していた。
しかし、これだと NeoBundleFetch でうまく扱えないようなのだ。
そのため、プラグインの更新時に NeoBundleUpdate とは別に NeoBundle.vim のために以下のようなコマンドを実行する必要があった。

$ git submodule foreach 'git pull origin master'

この1段階の手間が嫌になってきたので、NeoBundle.vim の管理を submodule から外すことにした。

submodule の外し方がややこしかったので少々悩んだのだが以下の方法で対応できた。
ちなみにここで使用している git のバージョンは 1.8.5.2.msysgit.0 である。
submodule の操作についてはバージョンによって違うらしいので注意が必要。


まず、対象のリポジトリを submodule 対象から外す。

$ git submodule deinit vimfiles/bundle/neobundle.vim
Cleared directory 'vimfiles/bundle/neobundle.vim'
Submodule 'vimfiles/bundle/neobundle.vim' (https://github.com/Shougo/neobundle.vim.git) unregistered for path 'vimfiles/bundle/neobundle.vim'

次に submodule として登録していたしていたファイル自体を削除する。

$ git rm vimfiles/bundle/neobundle.vim/
rm 'vimfiles/bundle/neobundle.vim'

更に .git/modules 以下のディレクトリも削除しなければいけないらしい。

$ rm -rf .git/modules/vimfiles/bundle/neobundle.vim

管理ファイルを直接削除して本当にいいの?と思いつつ削除。

status を確認すると対象が削除されていること、.gitmodules が更新されていることがわかる。

$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   .gitmodules
        deleted:    vimfiles/bundle/neobundle.vim

差分を確認するとこんな感じ。

$ git diff master
diff --git a/.gitmodules b/.gitmodules
index b71ab7e..e69de29 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +0,0 @@
-[submodule "vimfiles/bundle/neobundle.vim"]
-       path = vimfiles/bundle/neobundle.vim
-       url = https://github.com/Shougo/neobundle.vim.git
diff --git a/vimfiles/bundle/neobundle.vim b/vimfiles/bundle/neobundle.vim
deleted file mode 160000
index 603a8fe..0000000
--- a/vimfiles/bundle/neobundle.vim
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 603a8fe38a3d8291af15136607af8e4151ae0378

これらの結果を commmit する。

次に NeoBundle.vim を直接 clone する。

$ git clone https://github.com/Shougo/neobundle.vim ~/projects/dotfiles/vimfiles/bundle/neobundle.vim

この状態で Vim を起動して完了。