How do I work with a git repository within another repository?

The key is git submodules. Start reading the Submodules chapter of the Git Community Book or of the Users Manual Say you have repository PROJECT1, PROJECT2, and MEDIA… cd /path/to/PROJECT1 git submodule add ssh://path.to.repo/MEDIA git commit -m “Added Media submodule” Repeat on the other repo… Now, the cool thing is, that any time you commit … Read more

Git update submodules recursively

git submodule update –recursive You will also probably want to use the –init option which will make it initialize any uninitialized submodules: git submodule update –init –recursive Note: in some older versions of Git, if you use the –init option, already-initialized submodules may not be updated. In that case, you should also run the command … Read more

Update a submodule to the latest commit

Enter the submodule directory: cd projB/projA Pull the repo from you project A (will not update the git status of your parent, project B): git pull origin master Go back to the root directory & check update: cd .. git status If the submodule updated before, it will show something like below: # Not currently … Read more

No submodule mapping found in .gitmodule for a path that’s not a submodule

No submodule mapping found in .gitmodules for path ‘OtherLibrary/MKStore’ when $ git submodule update –init I didn’t know why the error occur. After spending a minute and found the answer in stackoverflow. $ git rm –cached OtherLibrary/MKStore and then update the submodule again. It’s working fine. http://en.saturngod.net/no-submodule-mapping-found-in-gitmodules

How to un-submodule a Git submodule?

If all you want is to put your submodule code into the main repository, you just need to remove the submodule and re-add the files into the main repo: git rm –cached submodule_path # delete reference to submodule HEAD (no trailing slash) git rm .gitmodules # if you have more than one submodules, # you … Read more