Pergunta

I'm working on improving source code redundancy in some projects and I'm faced with an issue.

Lets say I have some utilities that I use acros more projects. Example: build scripts and test scripts that are generic enough to be used on all projects but also have some config files that can be customized for each project.

I'd like to maintain the build-script logic in one place (fixing bugs and adding improvements) and get the changes easy in all projects that use it, but also without breaking the config files.

I know I can't do this with git submodules as the config file would need to pe commited to the utility repository instead of the project one.

I've been also looking over git-subtree, but I'm not sure it's doing what I want.

Did anyone get into this before?

Foi útil?

Solução

I know I can't do this with git submodules as the config file would need to be committed to the utility repository instead of the project one.

You actually could use submodules, if each of your projects was a git repository in its own.
Then each project (parent repository) would reference a specific commit of a specific branch of the utility repository, each branch with those utilities tailored for each project.

However, for tightly link set of files (utilities on one side,projects one the other), it is best to keep everything in one repository and to use a content filter driver:

content filter driver

You would have:

  • the generic utilities versioned as template (ie without their values)
  • value files (one for each project)
  • a versioned script able, on checkout in the 'smudge' script, to generate the final utilities in each project (provided your script is able to detect the content of the template utilities).
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top