[英]How to commit to a git repo ignoring changes to submodules?
When I run git commit -a
I would like it to skip committing changes to submodules. 当我运行
git commit -a
我希望它跳过将更改提交到子模块的操作。
(incase it matters, I want to have the latest version of all submodules but not commit these changes to the remote git repository). (以防万一,我想拥有所有子模块的最新版本,但不要将这些更改提交到远程git存储库中)。
How can this be done locally, so I can update submodules, but not commit changes to them? 如何在本地完成此操作,以便我可以更新子模块,但不提交对它们的更改?
So this works for eg: 所以这适用于例如:
git submodule foreach git origin master
Note that this seems similar to this question , but there seems some slight difference and the accepted answer doesn't work. 请注意,这似乎与此问题类似,但是似乎有些细微差别,并且可接受的答案不起作用。
Check if the setting diff.ignoreSubmodules
would help 检查设置
diff.ignoreSubmodules
是否有帮助
cd /path/to/my/repo
git config diff.ignoreSubmodules all
Then a add+commit should only include files of the main repo. 然后,一个add + commit应该只包括主仓库的文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.