How can I see the the submodules inside of my github repository?

Issue

Ive created one repo out of two small repos which are now submodules. In this Master Repo, I can change these submodules and commit them to a PR from the Master Repo, however in Github, I am unable to actually open the submodules in Github. They are hidden behind an unclickable file with the submodule repo # name and the folder icon has a little white arrow pointing right [see image]

enter image description here

This is the folder structure. Each submodule ofc has its own remote added pointing to the original repo that it came from.

Master Repo ->
  -submodule repo 1 
  -submodule repo 2 

How can I get github to actually show the contents of these submodules in things like pull request reviews and such?

Solution

If I look at my own repository github.com/VonC/git-cred, my submodule batcolors @ 83bcef4 is clickable.

It is composed of:

In your case, check if:

  • the submodule and its exact path are declared in your own .gitmodules file
  • if the associated URL is one GitHub can interpret.

How can I get GitHub to actually show the contents of these submodules in things like pull request reviews and such?

That is not supported with a submodule approach (reference to a sub-repository).

A subtree approach would:

  • preserve the Git history of the smaller repository before being "integrated" into the bigger one
  • show diffs during a pull request.

https://wac-cdn.atlassian.com/dam/jcr:f5fcef58-5b93-4ff4-b9a1-3f721d29ead8/BeforeAfterGitSubtreeDiagram.png?cdnVersion=637

Answered By – VonC

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published