您觉得合并代码舒适吗? [英] Do you feel comfortable merging code?

查看:87
本文介绍了您觉得合并代码舒适吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天早上,我读到了有关重构的两种观点.

This morning, I read two opinions on refactoring.

  • 意见1(页面不存在)
  • 意见2(页面不存在)

他们建议将代码分支(并随后合并)到:

They recommend branching (and subsequently merging) code to:

  1. 保持行李箱清洁
  2. 允许开发人员远离风险变化.

根据我的经验(特别是与Borland的StarTeam一起),合并是一项非常规的操作.因此,我仅在必要时分支(即,当我要冻结发布候选者时).

In my experience (particularly with Borland's StarTeam), merging is a non-trival operation. And for that reason, I branch only when I must (i.e. when I want to freeze a release candidate).

从理论上讲,分支是有意义的,但是合并的机制使其成为非常冒险的操作.

In theory, branching makes sense, but the mechanics of merging make it a very risky operation.

我的问题:

  • 您觉得合并代码感到自在吗?
  • 您是否出于除冻结发行版之外的其他原因分支代码 候选人?
  • Do you feel comfortable merging code?
  • Do you branch code for reasons other than freezing a release candidate?

推荐答案

一些宽松的指导原则:

  • 仅在需要时才分行
  • 经常合并
  • 请合适的人进行合并,无论是进行更改的人还是撰写原始版本的人都是最好的

分支只是另一种工具,如果您想获得最大利益,则需要学习如何有效地使用它.

Branching is just another tool, you need to learn how to use it effectively if you want the maximum benefit.

您对分支的态度在分布式开源项目(例如Git上的项目)和公司的开发项目(可能在SVN上运行)之间可能会有所不同.对于分布式项目,您将鼓励分支机构最大限度地利用创新和试验,对于后一种版本,您将需要更严格的控制并为每条代码行规定签入策略,该策略规定何时/不应该发生分支,主要是为了保护"代码.

Your attitude to branching should probably differ between distributed open source projects (such as those on Git) and your company's development projects (possibly running on SVN). For distributed projects you'll want to encourage branching to maximize innovation and experimentation, for the latter variety you'll want tighter control and to dictate checkin policies for each code line that dictate when branching should / should not occur, mostly to "protect" the code.

以下是分支机构的指南:
http://www.vance.com/steve/perforce/Branching_Strategies.html

Here is a guide to branching:
http://www.vance.com/steve/perforce/Branching_Strategies.html

以下是一些简短的指南,其中包含一些高级最佳实践:
https://www.perforce.com/pdf/scm-best-practices. pdf

Here is a shorter guide with some high level best practices:
https://www.perforce.com/pdf/scm-best-practices.pdf

这篇关于您觉得合并代码舒适吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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