8

MacVim インストール用の git リポジトリを作成しています。私のリポジトリのプラグインの中には、独自の .git フォルダーとリポジトリを持っているものがあります。問題は...これらのフォルダーの 1 つをメイン リポジトリに追加しようとしても、何も実行されないことです。

私の推測:

それ自体がgitリポジトリであるため、フォルダーを追加できません。サブモジュールとして追加するか、.git フォルダーを削除する必要があります。

サブリポジトリをサブモジュールとして追加するにはどうすればよいですか?

bryan-mini:.vim bsaltzman$ git status
# On branch master
# Changes not staged for commit: 
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#   modified:   bundle/YouCompleteMe (modified content)
#   modified:   bundle/nerdtree (modified content)
#   modified:   bundle/ultisnips (modified content)
#
no changes added to commit (use "git add" and/or "git commit -a")   

// This 
bryan-mini:.vim bsaltzman$ git add bundle/YouCompleteMe/
//  OR THIS
bryan-mini:.vim bsaltzman$ git submodule add bundle/YouCompleteMe/
repo URL: 'bundle/YouCompleteMe/' must be absolute or begin with ./|../

bryan-mini:.vim bsaltzman$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#   modified:   bundle/YouCompleteMe (modified content)
#   modified:   bundle/nerdtree (modified content)
#   modified:   bundle/ultisnips (modified content)
#
no changes added to commit (use "git add" and/or "git commit -a")
4

2 に答える 2

4

これらのリポジトリをサブモジュールとして正しく追加したように見えますが、それらのリポジトリ内のファイルを変更/追加/削除しました。bundle/nerdtree に cd して 'git status' を実行すると、何が違うのかがわかります。サブモジュールをクリーンな状態に戻すと、トップレベルのモジュールは「変更されたコンテンツ」と言うのをやめるべきです

また、あなたのコマンド:

git submodule add bundle/YouCompleteMe/

間違っています。「git submodule add」は、次のようなリポジトリ URL を取ります。

git submodule add https://github.com/Valloric/YouCompleteMe.git

しかし、あなたの出力からは、ある時点ですでにそれを正しく行っているように見えます。サブモジュールを管理するために Pathogen を使用しているようです。そのためのドキュメントは、このプロセスをかなりうまく説明しているはずです。または、明らかにいくつかの利点があるVundleに切り替えることもできます(個人的にはまだPathogenを使用しています)。

于 2013-12-09T16:26:52.243 に答える
0

サブフォルダーに存在するリポジトリを追加する正しい方法は、単純な実行です。

git submodule add (repo url)親フォルダに.

例えば:

cd ~/.vim/bundle
git submodule add https://github.com/Valloric/YouCompleteMe.git
于 2016-08-20T20:21:55.547 に答える