git submodule如何切换commit?

答: 操作步骤如下:

$ cd <submodule dir> (进入子模块的源码目录)
$ git checkout my-branch (切换到要使用的分支)
$ cd .. (退出子模块)
$ git status (检查commit的修改)
--- a/submodule
+++ b/submodule
@@ -1 +1 @@
-Subproject commit 0000000000000000000000000000000000000000
+Subproject commit 1111111111111111111111111111111111111111
$ git commit -s -m 'switch branch of submodule' (下次获取子模块时,将会直接将commit切换到这个指定的commit 1111111111111111111111111111111111111111)
$ git push (上传代码)
原文地址:https://www.cnblogs.com/dakewei/p/13523054.html