git repositories, advice?
I have several repositories: a repository managing a database schema (composed of some .sql files) and a Python SqlAlchemy model (model.py, and other repos, which need to use the Python model file only, but not the *.sql files.
开发者_如何学CIs it possible to get just the model.py file, perhaps as a submodule, in any of these other repos?
Currently:
REPO "db":
`-- model.py
`-- sql
`-- various *.sql files
REPO "website"
`-- various *.py files
`-- needs model.py...?
REPO "random-helper-script"
`-- various *.py files
`-- needs model.py...?
Since this is a Python project, I can isolate model.py into a folder, and make it a module that way.
Using submodules, I have the ability to either break out model.py into a repo by itself, or to just cope with the fact that I get all the *.sql files with the submodule. Thoughts?
It's a trade off. The extra space needed for the sql files that you are not interested in the other projects versus the need to put model.py in a separate repository and use it as a sub module in all repositories. It might feel a bit off to have model.py as a separate repository because you need it in two other repos, when it really belongs in the first project together with the sql files.
Assuming model.py is coupled with the sql files and often modified when the sql files are, I'd use the first repo as a sub module in the other two projects. Even though they might not care about the sql files, disk space is cheap :)
精彩评论