2013-06-12 147 views
0

我正在使用node.js進行機器學習。對於不同的方法有幾個不同的項目,我想將它們全部用於比較,所以我創建了一個父存儲庫machine-learning,它包含幾個(當前爲兩個)子模塊:「perceptron」和「classifier」。這兩個子模塊是我從其他存儲庫製作的叉子。提交對git子模塊的更改

現在,雖然我在主要的機器學習項目上工作,但我有時會對子模塊中的代碼稍作修改。但是,當我嘗試提交我的變化(我的叉子),這是行不通的:

[email protected]:~/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") 

[email protected]:~/git/machine-learning$ git add . 

[email protected]:~/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") 

我如何提交我的修改子模塊?

我不確定子模塊是否可行 - 也許有更好的方法在單個主項目中使用多個子項目,以便我還可以向每個子項目提交更改?

回答

1

你應該首先cd成一個子模塊,並提交你的修改有(這基本上是一個單獨的回購協議)。然後,在您的父回購中,您會看到子模塊已更新爲新提交,並且您將在主回購庫中記錄(addcommit)這一事實。

它應該是這樣的:

# On branch master 
# Changes not staged for commit: 
modified: classifier (new commits) 
+0

謝謝,這可是工作在命令行,當我嘗試從Eclipse的承諾(使用例如:It插件),我得到的,在附加到單個文件我將文件夾中的所有文件都更改爲「已刪除」,並將相同的文件更改爲子文件夾中的「新建」。例如,文件「README.md」被標記爲「已刪除」,並且文件「分類器/ README.md」被標記爲「新的」。 –

+1

這可能是一個EGit問題。順便說一句,[1.3版本的截圖](http://wiki.eclipse.org/EGit/New_and_Noteworthy/1.3#Submodule_Support)(這是第一個包含子模塊支持)表明子模塊是分開處理的。 – kirelagin