简体   繁体   English

应该在版本控制的主干或分支中完成新工作吗?

[英]New work should be done in trunk or branches in Version Control?

Hi i am learning about version controlling , trunks and branches . 嗨,我正在学习有关版本控制,主干和分支的信息。 i have read some articles and i am confused now 我读了一些文章,现在很困惑

one of them says . 其中一个说。

  • Developers commit all new work to the trunk. 开发人员将所有新工作提交到主干。 Day-to-day changes are committed to /trunk: new features, bug fixes, and so on. 每天的更改都将提交给/ trunk:新功能,错误修复等。
  • The trunk is copied to a “release” branch. 中继线已复制到“发布”分支。 When the team thinks the software is ready for release (say, a 1.0 release), /trunk might be copied to /branches/1.0. 当团队认为该软件可以发布时(例如1.0版),可以将/ trunk复制到/branches/1.0。

so here it says every major change is done in the trunk and when software is ready for release you should create a branch and do small bug fiixes theres 所以在这里它说每个主要的更改都在主干中完成,并且当软件准备发布时,您应该创建一个分支并在那里做一些小错误修复。

but another one says 但是另一个人说

  • trunk is guaranteed to be stable at all times 保证行李箱始终稳定

so seems that this one says , do major changes in branches :/ 所以似乎这个人说,做分支的重大改变:/

and a third article says 第三篇文章说

  • Trunk represents the next major version release . Trunk表示下一个主要版本。
  • A branch represents a specific release version. 分支代表特定的发行版本。

So i am confused here . 所以我在这里很困惑。

I have few questions 我有几个问题

1 when should we create a branch  ?  
2 Are we giving the release form branch or trunk ?  
3 Are we doing major changes in branches or only doing minor modifications
4 Are we doing the testing in branch or trunk 

Please answer these because i have spent more than 2 days to get an understanding about these and still i have no idea . 请回答这些,因为我花了超过2天的时间来了解这些内容,但我仍然不知道。 Thanks in advance :) 提前致谢 :)

UPDATE UPDATE

Project is a PHP project
we are doing a relase in every 2-3 weeks
we are using git 
Team size is 4
All are familiar with version control

What you have encountered is the many patterns for approaching version control. 您所遇到的是实现版本控制的多种模式。 A model that works well for a few projects I've worked on is this one: 一个适用于我从事的几个项目的模型是:

http://nvie.com/posts/a-successful-git-branching-model/ http://nvie.com/posts/a-successful-git-branching-model/

The summary is thus: 因此,摘要为:

  • master branch (Always production-ready to deploy at anytime) 主分支(随时可以随时进行生产部署)
  • develop branch (Represents the next set of features to go into production via merging into master). 开发分支(表示通过合并到母版中要投入生产的下一组功能)。
  • Feature branches (You may have several of these, representing the feature oriented work of subteams. For example, you may have one for feature-oauth, feature-loginform, etc, all would be merged into develop once completed). 功能分支(您可能有几个分支,代表子团队的面向特征的工作。例如,您可能有一个用于feature-oauth,feature-loginform等的对象,一旦完成,所有这些都将合并到development中)。
  • Bugfix/Hotfix branches (These are branched off of master when a hotfix is necessary, and merged back into master/develop when the bug/hotfix is done). Bugfix / Hotfix分支(需要修补程序时,这些分支将从master分支出来,并在完成bug / hotfix后合并回master / develop中)。

The article will help go into details about all of the different types. 本文将有助于详细介绍所有不同类型。 The workflow is designed to give you purpose built branches that make a statement about why they exist, where they came from, and where they are destined, which helps facilitate easy branching, merging, and team communication. 该工作流旨在为您提供目标明确的分支机构,这些分支机构说明它们的存在原因,它们的来源和目的地,从而有助于简化分支,合并和团队沟通。

Ideally, this would exist on a git server like github/bitbucket/gitlab that supports pull requests, so project leads/owners can accept the changes and review the team's workflow, etc. 理想情况下,它会存在于支持拉取请求的git服务器(如github / bitbucket / gitlab)上,因此项目负责人/所有者可以接受更改并查看团队的工作流程等。

However, the bottom line is that there is no 'answer' to this question, only recommendations. 但是,最重要的是,这个问题没有“答案”,只有建议。 Branching strategies are team specific, and the recommendations such as this one are very broad (they should help in a variety of cases), but you should favor a workflow that makes sense for your team :) 分支策略是特定于团队的,并且诸如此类的建议非常广泛(它们在各种情况下都应有所帮助),但是您应该偏向对您的团队有意义的工作流程:)

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

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