简体   繁体   English

使用项目的不同版本的Git工作流程

[英]Git workflow using disparate versions of a project

I have a website that recently split into two separate versions, that have fundamental functional differences. 我有一个网站,最近将其分为两个单独的版本,这些版本具有根本的功能差异。 Let's call them: 我们称它们为:

example.com alternate.example.com example.com Alternative.example.com

Each has their own git branch. 每个都有自己的git分支。

What I'm wondering is, when a new feature comes out that needs to be deployed to both versions of the site, how do I ensure that this change will not overwrite the key differences in the alternate version? 我想知道的是,当需要将新功能部署到站点的两个版本中时,如何确保此更改不会覆盖备用版本中的主要区别?

Simply put, let's say the index.php file for alternate.example.com runs a different database query than the example.com branch. 简而言之,例如,alternate.example.com的index.php文件运行的数据库查询与example.com分支不同。 Later, we realize that index.php has a security hole that needs to be patched. 后来,我们意识到index.php有一个安全漏洞,需要对其进行修补。 If I patch it on the example.com branch and merge into alternate.example.com, then alternate.example.com loses that distinguishing database query and becomes exactly like example.com. 如果我在example.com分支上对其进行修补并合并到alternate.example.com中,则alternate.example.com会失去与众不同的数据库查询,并变得与example.com完全相同。

Is that correct or am I doing something wrong? 那是正确的还是我做错了什么?

You need a common ancestor branch. 您需要一个共同的祖先分支。

So: 所以:

  • base 基础
  • example.com example.com
  • alternate.example.com Alternative.example.com

Base would contain the index.php code common to both. 基本将包含两者共同的index.php代码。 example.com and alternate.example.com would simply add their respective database queries. example.com和alternate.example.com只会添加它们各自的数据库查询。

Thus, the security hole would be fixed in base and merged/rebased onto the example.com and alternate.example.com branches. 因此,安全漏洞将固定在基础中,并合并/重新建立到example.com和alter.example.com分支上。

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

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