2013-10-24 4 views
8

MacVim 설치를위한 git 저장소를 만들고 있습니다. 내 저장소에있는 일부 플러그인에는 자체 .git 폴더와 저장소가 있습니다. 문제는 ...이 폴더 중 하나를 기본 저장소에 추가하려고하면 아무 것도 수행하지 않습니다.Git에 기존 Git 저장소가있는 폴더 추가

내 생각 엔 : 그것은 자신의 자식의 repo이기 때문에

내가 폴더를 추가 할 수 없습니다. 하위 모듈로 추가하거나 .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

그것은 올바르게 서브 모듈로 사람들의 repos를 추가했을 수 있지만 변경 한 것처럼/추가/사람들의 repos 내부 파일을 삭제 보인다. 번들/nerdtree로 cd하고 'git status'명령을 사용하면 차이점을 알려줍니다. 다시 최상위이 한 말을 중단해야 깨끗한 상태로 서브 모듈을 얻는 경우에, 또한

명령을 "내용 수정"

git submodule add bundle/YouCompleteMe/ 

이 올바르지 않습니다. '자식 서브 모듈 추가'는 환매 특약 URL과 같이합니다 :

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

하지만 당신은 이미 어떤 시점에서 제대로 그 짓을했는지처럼 출력에서 ​​보인다. Pathogen을 사용하여 하위 모듈을 관리하는 것처럼 보입니다. 하위 문서를 관리하는 문서는이 프로세스를 매우 잘 안내합니다. 또는 Vundle로 전환 할 수 있습니다. Vundle은 분명히 몇 가지 장점이 있습니다 (개인적으로 저는 아직 Pathogen에 있습니다).

git submodule add (repo url)을 상위 폴더에 : 하위 폴더에있는 기존의 repos를 추가 할 수

0

올바른 방법은 실행 간단하다. 예를 들어

:

cd ~/.vim/bundle 
git submodule add https://github.com/Valloric/YouCompleteMe.git