Git for project with overlapping public and private portions

45 views Asked by At

I'm trying to figure out what the cleanest way is to compose a public repository out of a subset of a private repository (or compose the private as a union with the public portion) and still have the shared files be updated in tandem. As an example, say I have these two files:

  • public_file
  • private_file

An end user should be able to pull only public_file, but maintainers should be able to modify both public_file and private_file. What git idiom would be suited to this kind of access control layout?

1

There are 1 answers

0
VonC On

For a single file, you would use a smudge content filter driver that would generate (automatically on git checkout) the private file out of an external value file and a versioned template file.

For a collection of files, you would use a git submodule, which would register the public files in a nested folder as a nested git repo of the main parent one: the private repo.