简体   繁体   English

Git Submodule或fork

[英]Git Submodule or fork

I have a private repo in github that is the complete source code to my cms. 我在github上有一个私人仓库,这是我的cms的完整源代码。 Now I have a few local customers that I want to use the same code base on but with different themes. 现在我有一些本地客户,我想使用相同的代码库,但具有不同的主题。 Is it better to fork the original project out into a repo for each one. 是否最好将原始项目分成每个项目的回购。 Or use a submodule and create a new repo for each customer? 或者使用子模块为每个客户创建一个新的仓库?

After each site is complete I would imagine the theme files wouldn't change much but would need to pull in changes from the main repo when bugs are discovered. 在每个站点完成后,我会想象主题文件不会发生太大变化,但是当发现错误时需要从主回购中提取更改。

Since there is two set of files involved (the common based, and the theme files), then submodules are appropriate. 由于涉及两组文件(基于公共文件和主题文件),因此子模块是合适的。

Each client would have: 每个客户都会:

  • a main git repo project 一个主要的git repo项目
    • one submodule cloning the common code base 一个子模块克隆公共代码库
    • one submodule with specific files for its theme. 一个子模块,其主题具有特定文件。

Forking is more a cloning technique able to isolate one version of a repo from its copy. 分叉是一种克隆技术,能够将一个版本的repo与其副本隔离开来。
GitHub implements it with a fork queue to facilite cherry-picking back some changes made in forked Git repo. GitHub使用fork队列来实现它,以便巧妙地回顾在分叉的Git仓库中做出的一些改变。
But the key thing here is: it concerns the all repository, not just one part. 但关键是:它涉及所有存储库,而不仅仅是一个部分。
If several parts are involved, submodules are the right answer. 如果涉及几个部分,子模块是正确的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM