我如何在github上维护不同的代码 [英] how do I maintain divergent code on github

查看:184
本文介绍了我如何在github上维护不同的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须维护一个基本版本的代码和不同变体的代码,并针对不同的客户站点进行客户特定的修改。

I have to maintain a base version of code and different "variations" of that code with client specific modifications for different clients sites.

强制所有客户使用同一个变体,或者拥有一个涵盖所有客户需求的超级变体。然而,这不是我的世界的本质,我不能改变它。

It would be much easier to force all clients on the same variant, or have a super variant that encompasses all clients' needs. However that is not the nature of my world and I can't change it.

给定这个环境,使用github的最佳方式是什么?

Given this environment, what is the best way to use github?

我可以为每个版本创建一个单独的存储库。我可以创建一个独立的分支库。无论哪种情况,我都会看到如何使用github作为每种变体的存储介质和版本控制,但我不明白我如何使用github来帮助管理代码分歧。

I can create a separate repository for each version. I can create one repository with separate branches. In either case I see how I can use github as a storage medium and version control for each variant, but I don't see how I can use github to help manage the code divergence.

感谢

thanks

推荐答案

基于您的问题,我会推荐一个带有主分支的单个回购。您可以使用其他分支作为变体。

Based on your question I would recommend a single repo, with a master branch. You can use other branches for the "variations".

棘手的部分是当提交进行提交时,不会干净地合并到另一个分支中。你可以用 git merge 做一个合并提交,但我更喜欢在新的<$ c上执行 git rebase $ c> HEAD master。通过这种方式,使用大师的人可以轻松地从该分支中​​引入更改。

The tricky part is when a commit is made to master that wont cleanly merge into another branch. You can do a merge commit with git merge, but I prefer to do a git rebase onto the new HEAD of master. This way people using master could easily pull in changes from that branch.

相关

这篇关于我如何在github上维护不同的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆