我正在使用node.js进行机器学习。对于不同的方法有几个不同的项目,我想使用它们进行比较,所以我创建了一个父存储库machine-learning,它包含几个(当前是两个)子模块:“perceptron”和“classifier”。这两个子模块是我从其他存储库制作的分支。
现在,当我处理主要的机器学习项目时,我有时会对子模块中的代码稍作修改。但是当我尝试提交我的更改(到我的分支)时,它不起作用:
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")
如何将更改提交给子模块?
我不确定子模块是否可行 - 也许在单个主项目中有更好的方法可以使用多个子项目,这样我也可以为每个子项目提交更改?
答案 0 :(得分:1)
您应首先cd
进入子模块并在那里提交更改(它基本上是一个单独的回购)。然后在您的父回购中,您将看到子模块已更新为新提交,您将在主回购中记录(add
和commit
)此事实。
它应该是这样的:
# On branch master
# Changes not staged for commit:
modified: classifier (new commits)