在Linux上使用Git 1.8.1.1.存储库如下所示:
master
book
Run Code Online (Sandbox Code Playgroud)
子模块创建如下:
$ cd /path/to/master
$ git submodule add https://user@bitbucket.org/user/repo.git book
Run Code Online (Sandbox Code Playgroud)
该book子模块是干净的:
$ cd /path/to/master/book/
$ git status
# On branch master
nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)
另一方面,主人显示书子模块有"新提交":
$ cd /path/to/master/
$ 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)
#
# modified: book (new …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用git子模块将10多个存储库聚合到一个结构中以便于开发.
它应该克隆模块并签出分支.而是以分离头模式检出模块.
git clone git@github.com:org/global-repository.git
git submodule update —init
cd config-framework
git status
$git status
#HEAD detached at b932ab5
nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)
gitmodules文件似乎没问题
$cat .gitmodules
[submodule "config-framework"]
path = config-framework
url = git@github.com:org/config-framework.git
branch = MY_BRANCH
Run Code Online (Sandbox Code Playgroud)
我们希望默认情况下检出MY_BRANCH分支,而不是分离头.我们如何实现这一目标?