Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue. What did you do before the bug happened? (Steps to reproduce your issue) (We've got a setup where our internal git repos provide wrapper scripts etc. for our environment and then pull in open-source projects, some of which we contribute to and others which we sponsor directly. We've been using submodules to make that work and de-couple the internal bits from the open-source bits). Cloned a repo including a submodule: $ git clone -v -b master --recursive ssh://git@<internal>/nyfix/OpenMAMA-omnm.git Cloning into 'OpenMAMA-omnm'... remote: Enumerating objects: 789, done. remote: Counting objects: 100% (789/789), done. remote: Compressing objects: 100% (461/461), done. remote: Total 789 (delta 498), reused 472 (delta 323), pack-reused 0 Receiving objects: 100% (789/789), 492.75 KiB | 970.00 KiB/s, done. Resolving deltas: 100% (498/498), done. Submodule 'staging' (https://github.com/nyfix/OpenMAMA-omnm.git) registered for path 'src' Cloning into '/Users/bill.torpey/temp/stash/OpenMAMA-omnm/src'... remote: Enumerating objects: 916, done. remote: Counting objects: 100% (127/127), done. remote: Compressing objects: 100% (58/58), done. remote: Total 916 (delta 63), reused 105 (delta 49), pack-reused 789 (from 1) Receiving objects: 100% (916/916), 563.50 KiB | 444.00 KiB/s, done. Resolving deltas: 100% (594/594), done. Submodule path 'src': checked out '7bb809da9746051b96c0448f8137f25eaf8c15d1' Noticed that the commit hash of the submodule does NOT match the commit hash when the submodule is cloned directly: $ git clone -v -b staging https://github.com/nyfix/OpenMAMA-omnm.git Cloning into 'OpenMAMA-omnm'... POST git-upload-pack (377 bytes) POST git-upload-pack (gzip 1559 to 810 bytes) remote: Enumerating objects: 916, done. remote: Counting objects: 100% (127/127), done. remote: Compressing objects: 100% (58/58), done. remote: Total 916 (delta 63), reused 105 (delta 49), pack-reused 789 (from 1) Receiving objects: 100% (916/916), 563.50 KiB | 454.00 KiB/s, done. Resolving deltas: 100% (594/594), done. $ cd OpenMAMA-omnm $ git status On branch staging Your branch is up to date with 'origin/staging'. nothing to commit, working tree clean $ git rev-parse HEAD a092be3bc330f53f644b53d80881bf30cadd367f What did you expect to happen? (Expected behavior) I expected the commit hash to be correct (a092be3bc330f53f644b53d80881bf30cadd367f) in both the recursive clone and the direct clone. What happened instead? (Actual behavior) The commit hash from the recursive clone is the hash of a different (more recent) commit: $ git switch release/1.0.0b branch 'release/1.0.0b' set up to track 'origin/release/1.0.0b'. Switched to a new branch 'release/1.0.0b' $ git rev-parse HEAD 7bb809da9746051b96c0448f8137f25eaf8c15d1 What's different between what you expected and what actually happened? The commit hash in the recursive clone is wrong. Anything else you want to add: Nope - just, thanks for taking a look. Please review the rest of the bug report below. You can delete any lines you don't wish to share. [System Info] git version: git version 2.49.0 cpu: arm64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon libcurl: 8.6.0 zlib: 1.2.12 uname: Darwin 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64 compiler info: clang: 16.0.0 (clang-1600.0.26.6) libc info: no libc information available $SHELL (typically, interactive shell): /bin/bash [Enabled Hooks] This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.