Member-only story

3 Tips to Improve Your Git Submodule Knowledge

How to work with Git submodules, hassle-free

Milos Zivkovic
Better Programming
4 min readJan 13, 2021

--

Git branches
Photo by Yancy Min on Unsplash.

Handling a large code base with Git causes a problem with the git fetch command. You don’t need the whole code base to change some styling.

Let’s say you’re building a service-oriented app. Pushing changes to a single repo will cause havoc. Without proper commit messages, you are left with a huge list of unrelated commits.

Committing to separate Git submodules could help. “Submoduling” separates the repo into smaller code bases. Separating concerns will lead to better code organization. For example, one submodule per service would be a good start.

In this article, I’ll try to broaden your knowledge on Git submodules. The article consists of three tips that save my life every day. Read through until the end for a sweet bonus tip.

Let’s dive in.

1. Use SourceTree for Managing Git Submodules

The pictures below show a possible Git submodule setup. We’ve separated the client app, server, and parser service into Git submodules.

SourceTree provides good Git submodule support. The image shows the root of the Git submodules. Below theSTASHES menu, you can expand the SUBMODULES menu.

--

--

No responses yet

Write a response