相关疑难解决方法(0)

忽略git子模块的新提交

背景

在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 ignore status git-submodules

73
推荐指数
4
解决办法
4万
查看次数

Git子模块跟踪远程分支

我正在尝试使用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分支,而不是分离头.我们如何实现这一目标?

git git-remote git-submodules git-branch

16
推荐指数
1
解决办法
1万
查看次数

标签 统计

git ×2

git-submodules ×2

git-branch ×1

git-remote ×1

ignore ×1

status ×1