git 存储库,建议?
我有几个存储库:一个管理数据库模式的存储库(由一些 .sql 文件组成)和一个 Python SqlAlchemy 模型(model.py 和其他存储库,它们只需要使用 Python 模型文件,而不需要使用 *.sql 文件是否
可以在任何其他存储库中仅获取 model.py 文件(也许作为子模块)?
目前:
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...?
由于这是一个 Python 项目,我可以将 model.py 隔离到一个文件夹中,并将其作为一个模块 使用子模块
,我可以将 model.py 单独分解为一个存储库,或者只处理我通过子模块获取所有 *.sql 文件的情况。
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.
Is 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个权衡。您对其他项目不感兴趣的 sql 文件所需的额外空间与将 model.py 放在单独的存储库中并将其用作所有存储库中的子模块的需要相比。将 model.py 作为单独的存储库可能会让人感觉有点不舒服,因为当它确实与 sql 文件一起属于第一个项目时,您需要在其他两个存储库中使用它。
假设 model.py 与 sql 文件结合在一起,并且经常在 sql 文件修改时进行修改,我将使用第一个存储库作为其他两个项目中的子模块。尽管他们可能不关心 sql 文件,但磁盘空间很便宜:)
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 :)