git - Approach to use git with two masters
问题描述
We have two customers (and counting) which share like 80% code of a project, the main differences are like images, config files and some HTML. There is nothing like a master, because without the individually data the project could not run.
What would be the best practice to handle this scenario with git? Is it possible to use git flow somehow?
Currently we just have 4 branches:
customer1_dev -> customer1_master
customer2_dev -> customer2_master
We are Cherry-picking most of the commits between those.
解决方案
在这种情况下使用 Git 管理代码库时的主要选择是从公共代码库分支,然后为每个客户维护单独的分支(并将对这些客户分支的提交限制为他们的特定内容)。所有共同的发展都应该发生在主线分支中。
然后,当您准备好为特定客户构建发布候选版本时,切换到他们branch
并执行以下操作:git merge master
进入该客户的分支。这会将所有更改从主线引入您的客户特定分支。
你可以做一个rebase
而不是合并。但这不太有利,因为如果在主线分支之外的客户分支中弹出错误,则可能更难追踪错误的根本原因。但是无论是 amerge
还是rebase
into 客户分支都应该为您描述的情况提供良好的工作流程。
推荐阅读
- reactjs - 尝试过滤我在 ReactJs 中使用 fetch API 获取的数据
- rust - 错误[E0412]:在此范围内找不到类型“字符串”
- wso2 - 尝试发布 API WSO2 2.6.0 时出错
- angular - Angular 2:从一个函数将值设置为变量,然后在同一类的另一个函数中获取它
- electron - 在 Windows 10 上滚动分页页面时,electron.js 中出现“GPU 进程意外退出:exit_code=34”错误
- javascript - ajax请求后如何在动态html中注册onclick函数?
- perl - Perl OOP 看不到新方法
- pytorch - 张量元组
- elixir - Escript 文件和 .gitignore
- python - 用于验证 json 文件内容的函数的 Pytest