1

I'm working on a React project. The repo name is "namo-design-system" inside this repo I used another repo "design-system".
I used git submodule command to add "design-system" to inside src folder of "namo-design-system"
My ide is vscode in explorer section inside src "design-system" is labeled with capital S as submodule there is .gitmodules file and in it, there are the path and URL of the submodule BUT when I use git submodule status nothing happens I tried it on git version 2.37.3.windows.1 and on the integrated terminal in vscode but nothing happens enter image description here

enter image description here

  • What's the problem? Looks like the submodule has been added correctly given there's files in `src/design-system` – Phil Oct 03 '22 at 02:42
  • _"there is .gitsubmodules file"_... shouldn't that be `.gitmodules`? – Phil Oct 03 '22 at 02:44
  • I want to fetch all branches in design-system from repo to my local machine – M.Amin Alizadeh Oct 03 '22 at 02:45
  • That's not how submodules work. They include another repo in your project at a specific commit – Phil Oct 03 '22 at 02:46
  • there is 4 other branches after main in design-system repo how can I access them on my machine? – M.Amin Alizadeh Oct 03 '22 at 02:49
  • Does this answer your question? [How can I specify a branch/tag when adding a Git submodule?](https://stackoverflow.com/questions/1777854/how-can-i-specify-a-branch-tag-when-adding-a-git-submodule) – Phil Oct 03 '22 at 02:51
  • just go into the submodule directory and you can change the branch as any git repo – Ôrel Oct 03 '22 at 07:54

1 Answers1

0

Check first if you actually do have a submodule (meaning if your parent repository has a .gitmodules file)

A git submodule status done from inside a (presumed) submodule folder should display:

-<sha1> ./

With <sha1> the submodule root tree SHA.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250