创建精简版和扩展版 Git 项目的最佳方式
我为php做了一个小框架。在这个项目中,我拥有我在大多数项目中使用的基本功能。我还插入了一些示例数据,这样我就不会忘记它是如何再次工作的。
我已经使用 git 将框架置于版本控制之下。现在一切都很好,我想在此基础上进一步发展。这是我第一个 git 项目,所以我不知道应该使用哪种方法。
好吧,我想做的第一件事是创建该项目的另外 2 个版本。正如我之前所解释的,我现在拥有的版本里面有一些示例数据。
因此,我想要创建的第一个版本是精简版本,删除了示例数据。我可以使用这个版本来创建任何新项目。
我要创建的第二个版本是扩展版本。它有精简版,结合示例数据,再加上一些扩展。
所以最后我有同一个项目的 3 个版本,小型、中型和大型。
现在最好的方法是什么?我应该为此创建 3 个存储库,还是可以为所有版本仅使用一个存储库。
I have made a little framework for php. In this project I have the basic functionalities that I use for most of my projects. I have also inserted some sample data so I do not forget how it all works again.
I have put the framework under version control using git. Everything works fine now and I want to further build on this. This is my first git project so I do not know which method I should use.
Ok the first thing I want to do is creating 2 more versions of the project. As I explained before the version I have now has some sample data inside it.
So the first version I want to create is a stripped down version, removing the sample data. I can use this version to create any new project.
The second version I want to create is an extended version. This has the lite version, combined with the sample data, plus some more extensions on it.
So in the end I have 3 version of the same project, small medium and large.
Now what is the best way of doing this. Should I create 3 repositories for this, or can I use just one repository for all the versions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用版本控制来维护多个开发流通常是一个坏主意。它将需要持续的合并活动,这容易出错且繁重。
您应该在不参考版本控制系统的情况下组织您的产品分层。也许这可能需要一个具有完整扩展版本的单一代码库,以及一个支持三个不同构建目标的构建系统。每个构建目标都包含完整产品的不同子集。
Using version control to maintain multiple streams of development is generally a bad idea. It'll require continual merging activity, which is error-prone and burdensome.
You should organise your product stratas without reference to the version control system. Perhaps this could entail a single code base that has the entire extended version, with a build system that supports three different build targets. Each build target includes different subsets of the full product.
如果您将这 3 个项目放在一起作为如何构建其他项目的示例,我会将它们保存在一个 git 存储库中。在 master 分支中创建最小的一个。然后从 master 创建 2 个新分支,为其他版本各创建 1 个。在中等分支中添加中等变化,在大型分支中添加较大变化。师父仍指小。
这样做的好处是当您意识到所有 3 个版本中都有一些您想要的新基本功能时。您只需在 master 中进行更改,然后在 master 上重新设置其他 2 个分支。
If you are keeping the 3 together as examples on how to build other projects, I would keep them in a single git repo. Create the smallest one in the master branch. Then create 2 new branches from master, 1 for each of the other versions. Add the medium changes in the medium branch, and the large changes in the large branch. Master still refers to small.
The advantage of this is when you realize there is some new base functionality that you want in all 3 versions. You just make the changes in master, and then rebase the other 2 branches on master.