我的项目中有一个kohana电子邮件模块(modules/email
)作为git子模块,电子邮件模块本身有一个git子模块(vendors/swiftmailer
)。
当我从swiftmailer
子模块中初始化modules/email
子模块时,它显示模块/电子邮件已被修改。
我不想提交它,因为我没有改变它加上我之前提交它并且它打破了我的git索引(我花了太多时间修复)。
我该怎么办?将它添加到.gitignore还是有更好的东西?
我对git子模块没什么经验。所以感谢任何建议。
答案 0 :(得分: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
建议采用这种方式。请注意,不应忽略它。