git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Can you do this with GIT?

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jul 27, 2007, 19:45 UTC
Message-ID
<alpine.LFD.0.999.0707271236410.3442@woody.linux-foundation.org>
In-Reply-To
<11834063.post@talk.nabble.com>
On Fri, 27 Jul 2007, CPD wrote:
Show 10 quoted lines
> 
> We produce variations based on a (mostly) common codebase. In CVS I set up
> "environment" modules for each platform, then when you are working on that
> platform, you simply check out the correct environment and build. Only the
> needed code and tools are exposed in that environment (this is important as
> clients must NOT see each other's code and most customers have some
> customization). I do this by defining and renaming modules in the CVSROOT
> modules file.
> 
> Does GIT support anything like this? Or another way to acheive the same end?

Depending on how big the individual pieces are, you can do it either with branches or subprojects.

If the "mostly common" codebase means that 90% of it really ends up being common, and what you have is a few config things and perhaps a library or two that either shows up or not, git branches would work really well.

And branches are totally independent of each other, so it's quite possible to have even "secret" things in one branch, and it would never get exposed to anybody else. The biggest worry you'd need to make sure of is that you don't want to merge such private branches directly with each other - since then the merged branch would see everything that was in the history of the other branch, even if the merge itself ended up not picking the "secret stuff".

So with branches that have private information, you'd have to have one "common" branch that doesn't have any of the private stuff at all, and do the general development on that, and then you can merge that common stuff into all the individual private branches (and if you want to go the other way, moving something from a private branch to the "common area", you'd have to cherry-pick just that particular detail into the common branch).

If you have bigger building blocks, and some of the whole building blocks need to be private, you'd probably want to use the subproject support, which would make for more of a CVS "modules" kind of thing and in that sense perhaps closer to what you do now, but I suspect that just using branches would actually end up being much simpler for you. It would depend mostly on how big those building blocks that you need to keep separate are.

		Linus
Previous: Ray LehtiniemiNext: Ray Lehtiniemi
Message 6 of 7 in “Can you do this with GIT?”
  1. CPDJul 27, 2007
  2. Johannes SchindelinJul 27, 2007
  3. Ray LehtiniemiJul 27, 2007
  4. Johannes SchindelinJul 27, 2007
  5. Ray LehtiniemiJul 27, 2007
  6. Linus TorvaldsJul 27, 2007
  7. Ray LehtiniemiJul 27, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.