Scott Keck-Warren
Scott Keck-Warren

Reputation: 1952

Branches from Common Code Base for App Specific Files in GIT

I'm trying to determine the best way to have multiple software products built off the same common code base using GIT.

My initial plan was to have a master branch with the common code/framework and to have the different products be branches off of this. I think as the code base builds up, when I perform a rebase it will take longer and longer to the point where it might become cumbersome. I don't know how bad this will be but it could be a potential problem.

Does anyone have a better way to do this or is the best option?

Upvotes: 1

Views: 254

Answers (3)

Jason
Jason

Reputation: 504

I would look at using a "git submodule" http://book.git-scm.com/5_submodules.html

This should allow you to make the common code its own repository and simply include it in the other projects as a submodule.

Upvotes: 1

Karl Bielefeldt
Karl Bielefeldt

Reputation: 49028

I would recommend doing merges instead of rebases. That way you'll only be dealing with whatever changed since the last merge.

The best option, though, is to modularize your code so you don't need separate branches.

Upvotes: 1

Carl
Carl

Reputation: 44448

You might want to apply this approach. Just think of the feature, develop, release and hotfix branches to be local to each product. The master would be common to all, which means that fixes in shared code would be pushed to the master and then get automatically absorbed into the other products as they iterate.

The difference between what you're currently thinking of and this one is that there is an extra merge step back to master which will force you to deal with conflicts on a regular basis which will keep the number of conflicts you encounter very manageable.

Upvotes: 0

Related Questions