Subproject commit changed incorrectly [Fixed]

Hi, so I’ve got the problem that git tells me that the subproject commit on my custom branch has been changed, even though I already merged with main and ran make update.

>git diff main lib/windows_x64
diff --git a/lib/windows_x64 b/lib/windows_x64
index ab368c849a0..a5521c85e03 160000
--- a/lib/windows_x64
+++ b/lib/windows_x64
@@ -1 +1 @@
-Subproject commit ab368c849a05d03de613764ab9739d2e16a41643
+Subproject commit a5521c85e03bfd1556ff1e63bf7163235c401497

How do I make it match main again?

Edit:
I found out that the problem was actually caused by git worktree.

When merging from a working tree into main it will merge everything except for submodules, which lib/windows_x64 happens to be.

For some reason using wildcards such git add * won’t add the changed submodules (might be a bug in the Git version I use?) bit using git add lib/windows_x64 will stage the changed submodules for commit.
Commiting then makes the local branch have the same submodules as main.

Hi,

I believe these commands will fix it for you:

git reset origin/main lib/windows_x64
git commit -m'Fix submodule'
git submodule update

In the future better to avoid doing git add . at the top folder of the source code. Or even git commit -a. One of these are likely the cause of the issue you are running.

1 Like

Thanks! I found out that the problem was actually caused by git worktree.

When merging from a working tree into main it will merge everything except for submodules, which lib/windows_x64 happens to be.

For some reason using wildcards such git add * won’t add the changed submodules (might be a bug in the Git version I use?) bit using git add lib/windows_x64 will stage the changed submodules for commit.
Commiting then makes the local branch have the same submodules as main.

1 Like