News Stay informed about the latest enterprise technology news and product updates.

How to create Git submodules in GitHub and GitLab

In a previous git submodules tutorial I added submodules to a stand-alone repository. There was no push or pull to or from GitHub or GitLab. In this GitLab and GitHub submodules add example I will pull from two independent GitHub repositories and then create the submodule linkage between them. The video at the end of this tutorial demonstrates the same git submodule add in GitLab. The two repositories will be named:

  • surface
  • submarines

The git submodule add command create a .gitmodules file.

I will allow you to deduce on your own which one is the parent module and which on is the Git submodule.

How to create submodules in GitHub

The following list of steps will add Git submodule GitHub relationships between two repositories:

  1. Clone the parent or top-level repository
  2. In the root of the parent issue a git submodule add command and provide the GitHub repository’s URL
  3. Issue a git status command to verify a .gitmodules file is created in the parent project
  4. Add the .gitmodules file to the index and perform a git commit
  5. Push the GitHub submodule add commit back to the server

GitHub submodule add commands

The following is the list of command performed in the GitHub submodule add example.

submodule@example:~$ git clone
submodule@example:~$ git log --oneline
submodule@example:~$ git cd surface
submodule@example:~$ git submodule add
submodule@example:~$ git status
submodule@example:~$ git git add .
submodule@example:~$ git git commit -m "Add GitHub submodule"

GitHub submodule push

It should be noted that the created GitHub submodules are treated as separate, independent repositories. To prove this point, a file named tugboat.html is added to the surface module and a file named xia.html is added to the added GitHub submodule. Note that a push from each repository is required to move changed files back to the GitHub server. A push from the parent does not automatically force new commits in the submodule to be pushed as well.

submodule@example:~$ git touch tugboat.html
submodule@example:~$ git add .
submodule@example:~$ git commit -m "Add the tugboat file"
submodule@example:~$ git push origin
submodule@example:~$ cd submarines
submodule@example:~$ touch xia.html
submodule@example:~$ git add .
submodule@example:~$ git commit -m "Add xia class sub"
submodule@example:~$ git push origin









Join the conversation


Send me notifications when other members comment.

Please create a username to comment.

Great post.
You should also take into account mobile app usability testing. By improving the app usability, you will drive mobile engagement, conversions and in-app monetization and reduce user churn.
I suggest to use a remote usability testing, like Appsee (, which enables you to watch and understand everything your users do in your app, including problems they are experiencing and crashed sessions, and fix the problems accordingly for improved usability.
You sort of overlooked all the hybrid options available to both enterprise and consumer based apps. Appcelerator, Xamarin, both deliver semi-native performance while addressing, each to their own extent, the cost of platform-specific development
First of all people would check for its pricing. Then with the process of app development which includes project management, architecture design, programming, testing and validation. Next the platform to choose ? Whether its native, hybrid or mobile web. Its always better to choose the right mobile app development company.

QA is such a big issue. We've seen too many good apps rushed into a crowded market with little testing or time for beta feedback. More often, the end user - who's trying to put the app to work as advertised - become the test bed.

When whatever the problem is aa simple (simple...?) as an occasional crash, the impact is probably minor. When it means lost data, the absence of testing becomes more critical. But when user input becomes vulnerable to hacking, then it's an intractable problem with severe results.

Good software takes time to develop and debut. Mobile apps should be no different.
Building mobile app is best option for increasing customer loyalty and engagements. It is necessary for business to know the answer of basic questions and which is better? is one of the basic question. I want to know the same...
When developing an app you need to consider the end user. They may all want certain features. You cannot please them all so, you have to weigh the pros and cons and keep the larger and more profitable customers as happy you can without losing the rest of you customers. Rushing to put product out may do more harm than you realize. I have seen some bad ones and because of that stopped using them all together.

Thanks. It would be great if you just mention what are the areas where I will have to spend for application development if I am an individual developer ?
“A typical app developed from the base can easily cost you around $6,000 to $10,000, and this normally depends on the complexity of your app. ” Please explain the areas where the money are spend.