How to move a sub-project into a new Git repo?

Soldato
Joined
1 Nov 2007
Posts
6,321
Location
England
I have a website built using Python and Django. When I first started it I thought it would just be one monolithic project but as I have worked on it over time I'm starting to think that the forum and blog part could be moved to separate repos and released as open source projects on their own.

I'm just curious what the best practice is for doing this? I was just going to do it the simple way of just moving them outside of the project tree and creating a new git repo for each and then pushing to Github. Is there a better way of doing this? The projects will be linked into the main project just by using a symlink.
 
What did you end up doing, out of curiosity?

One idea that comes to mind is duplicating the whole repo, including history. Then in one of them you delete everything except the forum and blog part, and in the other you do the opposite. Then both repos will retain full commit history. Of course if you're releasing one as open source then you wouldn't want to reveal the commit history that includes all the other files. But in other cases it might be useful.
 
What did you end up doing, out of curiosity?

One idea that comes to mind is duplicating the whole repo, including history. Then in one of them you delete everything except the forum and blog part, and in the other you do the opposite. Then both repos will retain full commit history. Of course if you're releasing one as open source then you wouldn't want to reveal the commit history that includes all the other files. But in other cases it might be useful.
I ended up moving the blog and forum out of the main project tree and created a git repo for each. I then added a symlink in the main project tree to the folders with the blog and forum. This meant I had three repos. The main project had the plumming which was required for getting the forum and blog running for testing and was set as a private repo on Github. The forum and blog ended up on Github as publc individual repos.
 
Look at git submodules. It's what I use for my unreal stuff on github.

One master demo project, with all my plugins included as submodules. Means in the main project branch you just track which version of the submodule you want.
 
Look at git submodules. It's what I use for my unreal stuff on github.

One master demo project, with all my plugins included as submodules. Means in the main project branch you just track which version of the submodule you want.
That is a good plan. Thank you.

I find all the available options Git has somewhat overwhelming. I should probably sit down one day with a pot of coffee and just read all the docs.
 
Back
Top Bottom