This is just a short post and the title says it all … I’ve wanted add submodules to a Git repository but you get an error if you try.  So how do you add a submodule to your root folder in your Git project?  Easy - Git Subtree Merge is what you need.

Add your 2nd Git Project as a Remote

Actually, you start by adding a git remote with the source being the git project you want to pull in.

Git Remote SourceTree

The you do a pull from your Remote … and merge / diff any of the files

Gite Remote Merge

Now you have your second project added in the root of your main project 🙂   So .. go to your second project .. make a change and commit and push it  … then go back to your first project and you’ll see the remote has an update 🙂






Git Subtree Merge on Git SCM