英文:
Can I use branch for different projects in single repo?
问题
我有一些具有独立代码的项目,但目的相似。我可以创建一个巨大的Git存储库,然后创建不同的分支来容纳不同的项目吗?
例如,我想创建一个名为"database"的存储库,并创建不同的分支来容纳MySQL、PostGres和ClickHouse的源代码。这有意义吗?
英文:
I have some projects with independent code, but similiar purpose. Can I create a giant git repo and create different branch to hold different projects?
For example I want to create a repo named database, and create different branches to hold source code of MySQL, PostGres and ClickHouse. Does it make sense?
答案1
得分: 2
以下是翻译好的部分:
git switch --orphan
用于创建新的孤立分支get merge --allow-unrelated-histories
用于在具有不同根的分支之间进行合并get worktree
用于在单独的文件夹中检出分支git submodule
轻松处理指向相同存储库的子模块
英文:
Some git operations will be slower due to the size of such a repository, but it is perfectly fine.
Git even comes with a lot of built-in support for creating and working with repositories like this:
git switch --orphan
for creating new orphan branchesget merge --allow-unrelated-histories
for merging between branches with different rootsget worktree
for checking out branches in a separate foldergit submodule
easily handles submodules that point into the same repository
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论