Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git reports that submodule has changes even if it does not

Tags:

git

I have git repository where I have several submodules. I have fetched latest commit in main git repo. But If I type git checkout origin/master then I got error because of changes in submodules that should be commited first. In main repo git status shows that there are changes in submodules. But git status in each submodule shows no changes. When Issue git diff some_submodule from main repo there are changes which only shows changing of commit ID:

diff --git a/some_submoduleb/some_submodule
index 21c00cb..2392944 160000
--- a/some_submodule
+++ b/some_submodule
@@ -1 +1 @@
-Subproject commit 21c00cb4729feacd95a9ea01d100a2e0f2ddb604
+Subproject commit 2392944290df7d41ad3abfe50f71e5c3886de798

Why is this happening and how can checkout origin/master in main repo?

Config:

  • OS: Ubuntu
  • git version: 2.17.1
like image 546
Wakan Tanka Avatar asked Jun 01 '26 01:06

Wakan Tanka


1 Answers

You could try this.

git submodule update

If you're using Visual Studio, right-click in the Git Changes window and select Submodule Update.

enter image description here


Git Submodules: https://git-scm.com/book/en/v2/Git-Tools-Submodules

like image 63
suyeon woo Avatar answered Jun 03 '26 13:06

suyeon woo