0

我正在使用 node.js 进行机器学习。不同的方法有几个不同的项目,我想用它们来比较,所以我创建了一个父存储库machine-learning,其中包含几个(当前两个)子模块:“感知器”和“分类器”。这两个子模块是我从其他存储库中创建的分支。

现在,当我从事主要的机器学习项目时,我有时会对子模块中的代码进行轻微修改。但是当我尝试提交我的更改(到我的 fork)时,它不起作用:

erelsgl@erelsgl-H61MLC:~/git/machine-learning$ git commit -a
# 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:   classifier (modified content, untracked content)
#   modified:   perceptron (untracked content)
#
no changes added to commit (use "git add" and/or "git commit -a")

erelsgl@erelsgl-H61MLC:~/git/machine-learning$ git add .

erelsgl@erelsgl-H61MLC:~/git/machine-learning$ git commit -a
# 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:   classifier (modified content, untracked content)
#   modified:   perceptron (untracked content)
#
no changes added to commit (use "git add" and/or "git commit -a")

如何提交对子模块的更改?

我不确定子模块是要走的路——也许有更好的方法在一个主项目中使用多个子项目,这样我也可以提交对每个子项目的更改?

4

1 回答 1

1

您应该首先cd进入一个子模块并在那里提交您的更改(它基本上是一个单独的 repo)。然后在您的父仓库中,您会看到子模块已更新为新的提交,您将在主仓库中记录(addcommit)这一事实。

它应该如下所示:

# On branch master
# Changes not staged for commit:
modified:   classifier (new commits)
于 2013-06-12T12:20:33.120 回答