Git: How to add a submodule in the root of your project – Try Git SubTree instead

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 🙂

 

 

 

 

Linkage

Git Subtree Merge on Git SCM

Tags: ,

One Response to “Git: How to add a submodule in the root of your project – Try Git SubTree instead”

  1. majgis June 26, 2013 at 10:15 pm #

    Very helpful, thanks!