答: 操作步骤如下:

$ 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 (上传代码)

相关文章:

  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2022-02-18
  • 2021-12-24
  • 2022-12-23
  • 2022-01-06
猜你喜欢
  • 2021-05-30
  • 2022-12-23
  • 2021-10-30
  • 2020-11-15
  • 2021-07-11
  • 2021-09-24
相关资源
相似解决方案