tags:

views:

79

answers:

3

I've got a web site that contains a set of effectively independent tools with each tool having its own directory. For example:

/webroot /webroot/tool-1 /webroot/tool-2 /webroot/tool-3

Development for each tool takes place individually, so being able to create different branches at different times for each is imperative.

I'm looking at moving to Git for version control and from what I've gathered from the documentation, the best bet would be to create one git repository for each of the tools. I'm curious though, if there is a way (and more to the point, if it's advisable) to have a single repository at the webroot level but still maintain the sub level tool-# directories in an independent manner.

(Note: The main reason I'm interested in this is because I'm looking at purchasing a private space on GitHub. If everything can easily and effectively go under one repository without causing a maintenance nightmare I would be able to utilize a less expensive plan than if I had to create one repo for each of the fifteen or so tools.)

+1  A: 

They should be in separate repositories. However, you could probably manage something similar, without much of a maintenance headache, by placing them all in the same repository, but doing development on each tool in its own branch.

So, for example, check everything in at once and then create branches "tool1", "tool2", ...

Developers work on those branches. In fact, if you start with an empty repository and create the branches from there, you could separate the tools completely from each other, but retain the ability to merge them together if you ever wanted to.

Jonathan
If I deleted the other tools from the individual tool's branches, this would mean that I couldn't commit them back to the master without having the other tools removed there as well, right?I'm still new to git, so I want to make sure I under stand this. Basically, if I did this, I would just keep the branches as the primary development trees instead of pushing the changes back to master, right?
anotherAlan
The merge could get messy. How about creating an empty repository, branching off of that for each of your tools, and then only checking those tools into their branches? You could very easily merge them together at a point in the future, without worrying about the "delete" operation that would show up from my original suggestion. And yes, you would keep the branches as the primary development trees rather than pushing back to master all the time.
Jonathan
I modified my answer accordingly.
Jonathan
+2  A: 

I'd say it depends on whether the individual tool directories are truly independent, or if they're interrelated in some way. In Git, it's usually best to have a separate repository for each individual, independent project. In the case of your website, if each tool is independent, I'd make a separate repo -- but if they share any code between them, you might want to use just one repo.

Of course, nothing in Git prevents you from having a single repo; it might make the history of changes a bit more complicated, but that's the only major downside. And deploying to your website's production server might even be easier with a single repo.

Your situation is also complicated a bit by the use of private repos on GitHub, since, as you say, you'll need a more expensive plan if you have a separate repo for each tool. I guess you'll have to balance the economics of the situation with the technical issues involved in having a single or multiple repos.

mipadi
I hadn't thought all the way through the deployment portion of the equation. There are a few elements (headers and footers) that overlap, but I've always just treated those as their own pseudo-tool and deployed them on their own. This was largely based off the way my Subversion repository was setup to deal with individual tool branches. Still adjusting the mind set to the way git works.
anotherAlan
If they are separate repositories you can use subproject for easy deployment.
Joel Hooks
The way I'm going to approach this initially is to use one repository that contains everything. For the main development, I'll then create one branch for each tool as I need to work on them. When the tool is in a stable state and ready to deploy, I'll merge it back into the master branch. If I need to work on multiple features for a given tool at the same time, I'll simply create additional branches as needed.
anotherAlan
A: 

You can do arbitrary splitting and merging of repositories with the git subtree tool.

apenwarr