Use git subtree to modularization

Here is my situation, I’ve been developing several projects at the same time. There are some libraries are shared with these projects. After googling I found some really good articles:

How We Modularized Medium’s iOS codebase

git subtrees: a tutorial

Git Subtree Tracking Made Easy

Now the following is my solution:

1. create a skeleton project, then all the other project clone from it

2. modify the remote

3. edit the file “.gitsubtrees” at the root of every project

4. use the script “script/”  to add the subtrees

execute the command at the root of the project

5. use the script “script/” to push all the changes of the subtrees to their repositories

6. use the script “script/” to pull the latest update from repositories to the subtrees


Leave a Reply

Your email address will not be published. Required fields are marked *