a blog for those who code

Monday 23 June 2014

Create sub repository inside a repository in Git

Suppose you are working with other source code management tools other than Git, lets take an example of SVN and you want to move all your source code to Git, then you can create sub repository inside your actual repository like Externals in SVN.

For doing this you have to first create a local git repository from your actual svn repository (recommended use svn2git).

Now you have projectA and you want to move projectB inside projectA. You have to run the following command inside projectA directory :

git remote add projectB D:/projectB
git fetch projectB
git merge projectB/master
git remote rm projectB
git gc --aggressive
git push origin master

This will move the actual projectB repository inside projectA with all the histories intact.

If you have any questions, feel free to ask.

No comments:

Post a Comment