2011-12-21 52 views
0

我有一個kohana電子郵件模塊(modules/email)作爲我項目中的git子模塊,並且電子郵件模塊本身有一個git子模塊(vendors/swiftmailer)。
當我從modules/email子模塊中啓動swiftmailer子模塊時,它顯示模塊/電子郵件已被修改。
我不想承諾它,因爲我沒有改變它,加上我之前承諾它,它打破了我的git索引(我花了太多時間修復)。
我該怎麼辦?將它添加到.gitignore還是有更好的?
我幾乎沒有使用git子模塊的經驗。所以謝謝你的任何建議。我應該提交嵌套的git子模塊嗎?

回答

1

無論您何時編輯submodule,都應該使用"Update submodule: xxx"之類的信息來提交。
所以當你編輯swiftmailer時,你的modules/email應該在承諾seiftmailer之後提交。

cd modules/email/vendors/swiftmailer 
// do sth 
git add . 
git commit -m "Some modifies of swiftmailer" 

cd ../.. 
git add vendors/swiftmailer 
git commit -m "Update submodule: swiftmailer" 

cd ../.. 
git add modules/email 
git commit -m "Update submodule: email" 

submodule中推薦使用此方法。並且請注意,不應該被忽略。

+1

這很有道理。感謝您的洞察力。 – Brenden

相關問題