为什么git reset --hard不重置子模块中的提交哈希?

时间:2019-06-25 22:28:48

标签: git git-submodules git-reset

我有4个子模块的项目,其中2个不同步:

$ git submodule status
+ae633d13612e49a4d636ade1b20de7c306de9a40 devops-tools (heads/master)
 361fad5d187573d9bbb6aef67599f434c0bb7260 factorie (factorie_2.11-1.2-74-g361fad5d1)
 e702f2ffe7fa785acc97983500be6b6f995d5fa1 foundation (heads/master)
+69330f56f5db54c28a95752c7cc3a974af9cdd5e spookystuff (0.3.0-RC1-1167-g69330f56)

小号+表示未暂存这些提交哈希,可以在以下消息中看到同步的提交哈希:

$ git submodule summary
* devops-tools 2e576eb...ae633d1 (2):
  > Additional tests for local and chained passports
  > Add policy for github issue 278

* spookystuff feeec3e...69330f5 (3):
  > fix an NPE caused by val overriding def ctg
  > move 1 closure out of test body to avoid a NotSerialisable error
  > fix a serialisation error merge process name & command into a single condition Fixed a few test case due to parser injection Additional tests for local and chained passports fix 2 pattern matching errors caused by type erasure several refactorings that use more accurate names

我想同步它们,所以我执行以下命令:

$ git add *
The following paths are ignored by one of your .gitignore files:
datapassports.iml
target
Use -f if you really want to add them.
$ git reset --hard
HEAD is now at e1d426df8 issue 284, ...

$ git submodule update --init --remote --recursive --force
Submodule path 'devops-tools': checked out 'ae633d13612e49a4d636ade1b20de7c306de9a40'
Submodule path 'factorie': checked out '361fad5d187573d9bbb6aef67599f434c0bb7260'
Submodule path 'foundation': checked out 'e702f2ffe7fa785acc97983500be6b6f995d5fa1'
Submodule path 'spookystuff': checked out '69330f56f5db54c28a95752c7cc3a974af9cdd5e'

但是似乎没有什么改变,命令git reset --hard FAILED将子模块设置为正确的哈希值:分别为2e576eb和Feeec3e。这种设计的目的是什么?如何解决?

0 个答案:

没有答案