2016-07-15 3 views
0

하위 모듈이 submodule1 인 자식 저장소 (mainrepo)를 복제했습니다. 내가 submodule1에서 최신 업데이트를받을 때 :git submodule update --remote가 작동하지 않습니다.

$ cd mainrepo 

$ git submodule add [email protected]:myaccount/submodule1.git 

$ git submodule update --remote submodule1 
Usage: git submodule [--quiet] add [-b branch] [--reference <repository>] [--] <repository> [<path>] 
    or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...] 
    or: git submodule [--quiet] init [--] [<path>...] 
    or: git submodule [--quiet] update [--init] [-N|--no-fetch] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...] 
    or: git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...] 
    or: git submodule [--quiet] foreach [--recursive] <command> 
    or: git submodule [--quiet] sync [--] [<path>...] 

$ git submodule update --remote 
Usage: git submodule [--quiet] add [-b branch] [--reference <repository>] [--] <repository> [<path>] 
    or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...] 
    or: git submodule [--quiet] init [--] [<path>...] 
    or: git submodule [--quiet] update [--init] [-N|--no-fetch] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...] 
    or: git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...] 
    or: git submodule [--quiet] foreach [--recursive] <command> 
    or: git submodule [--quiet] sync [--] [<path>...] 

를 내가 한 번 submodules이 방법을 업데이트하려고 확신, 워드 프로세서 이렇게도 할라고, 아직 작동하지 않는 이유를 이해하지 않습니다.

하지만이 페치와 submodule에 직접 병합 경우,이 최신 저장소에 업데이트 될 때 내가 그것을 원하는대로 커밋 :

$ cd submodule1 

$ git fetch && git merge master 

하지 않는 이유는 무엇 submodule update --remote submodule1 명령을 사용할 수 있습니까?

은 어쩌면 도움이 될 수 있습니다

$ vim mainrepo/.git/config 
[core] 
     repositoryformatversion = 0 
     filemode = true 
     bare = false 
     logallrefupdates = true 
[remote "origin"] 
     fetch = +refs/heads/*:refs/remotes/origin/* 
     url = [email protected]:myaccount/mainrepo.git 
[branch "master"] 
     remote = origin 
     merge = refs/heads/master 
[submodule "local/src/utils"] 
     url = [email protected]:myaccount/submodule1.git 

$ vim .gitmodules 
[submodule "submodule1"] 
     path = submodule1 
     url = [email protected]:myaccount/submodule1.git 
+2

어떤 버전의 자식 ('git --version')입니까? – larsks

+0

그 컴퓨터에있는 쓰레기 자식 버전은 1.7.1입니다 ... 원격 서브 모듈 업데이트는 개인용 컴퓨터에서 작동하며 자식 버전은 2.9.0으로 업데이트됩니다. – kaligne

답변

1

내가 자식에서 서브 모듈에 충돌 과정을 읽어 보시기 바랍니다 것입니다 : https://git-scm.com/book/en/v2/Git-Tools-Submodules 내 생각 엔 이미 복제 된 저장소가 서브 모듈을 가지고 있기 때문에 (확인한다는 것입니다

repo의 루트에 .gitmodules!) 다시는 git submodule add 일 필요가 없습니다.

저장소를 복제 한 후 git submodule update --recursive을 실행하면 충분합니다.

또는 git clone --recurse-submodules은 자동으로이 작업을 수행합니다.

관련 문제