Monday, January 28, 2013

git submodules

When you need sub projects to be attached to other git,
its possible to do this with git submodule.

first, if you have already added this sub module as part of the root git, remove this with:
(remember to do a backup first):
git -rm -r --cached lib/mymodule

#next,
cd lib/mymodule
git init
#add .gitignore if required
git add *
git commit -a

#now back to root project and add this sub directory as sub git
cd ../../
git submodule add ssh://remote-path-to-git/ lib/mymodule
git commit -a
#notice .gitmodules and file: /lib/mymodule will be added to git





No comments: