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
https://medium.com/medium-eng/how-we-modularized-mediums-ios-codebase-8f8f26965c76

git subtrees: a tutorial
https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844

Git Subtree Tracking Made Easy
http://endot.org/2012/02/12/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/git-subtree-init.sh”  to add the subtrees

execute the command at the root of the project

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

6. use the script “script/git-subtree-pull-all.sh” to pull the latest update from repositories to the subtrees

 

Leave a Reply

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