Source Control HOWTO

 

Source Control HOWTO

如何作源代码控制
I have started writing a series of articles explaining how to do source control and the best practices thereof. See below for links to the individual chapters in this series. The Introduction explains my motivations and goals for writing this series.
我开始写一系列解释源代码控制和最佳实践的文章。这个系列都包含在如下的各个章节中。我在介绍里面解释了写这个系列的动机和目的。
Please note: This is a work in progress. I plan to be adding new
chapters over time, and I may also be revising the existing chapters as I go along.
请注意:这是一个在不断进行的工做。我打算随时添加新的篇章,而且我会修订已经写好的篇章。
 
Printer-friendly version:  Sorry folks, but I currently do not have this material available in a form which is more suitable for paper.  Someday I probably will, and when that happens, a link will appear here.
方便的打印版本:对不起,各位,可是我如今没有适合打印的纸张样式提供。或许过段时间能够,到那个时候,我这里将会有一个连接的。
 
Chapter 0: Introduction

0 简介

Our universities don't teach people how to do source control.  Our employers don't teach people how to do source control.  SCM tool vendors don't teach people how to do source control.  We need some materials that explain how source control is done.  My goal for this series of articles is to create a comprehensive guide to help meet this need.
咱们的大学并不教咱们如何作源码控制,咱们的雇主也不教咱们若是作源码控制,配置管理工具商家也不教咱们如何作源码控制。那咱们就须要什么材料来解释如何作源码控制。我写这系列文章的目的就是要建立一个能解决这些需求的全面地使用指南。
 
What is source control?

什么是源码控制?

Sometimes we call it "version control".  Sometimes we call it "SCM", which stands for either "software configuration management" or "source code management".  Sometimes we call it "source control".  I use all these terms interchangeably and make no distinction between them (for now anyway -- configuration management actually carries more advanced connotations I'll discuss later).
有的时候咱们称源码控制为版本控制,有的时候咱们又称它为软件配置管理,不论是“软件配置管理”仍是“源码管理”,有些时候咱们都称为“源码控制”,我老是交替的使用这些术语,而且没有强调他们的区别。(固然,配置管理实际上包含了更多的内涵,我将在后面进行描述。)
By any of these names, source control is an important practice for any software development team.  The most basic element in software development is our source code.  A source control tool offers a system for managing this source code.
无论怎样说这几个名称,源码控制都是对软件开发团队极为重要的一个实践。在软件开发里面最基本的元素就是咱们的源代码。源代码控制工具就是一个用于管理这些代码的系统。
There are many source control tools, and they are all different.  However, regardless of which tool you use, it is likely that your source control tool provides some or all of the following basic features:
如今有不少源码控制工具,他们都是不相同的。可是,无论你用什么工具,看起来如今有的源代码控制工具都提供了下面列出的基本技能中的一些或者全部:
It provides a place to store your source code.
It provides a historical record of what you have done over time.
It can provide a way for developers to work on separate tasks in parallel, merging their efforts later.
It can provide a way for developers to work together without getting in each others' way.
提供一个空间存放源代码。
提供随时间变化的历史记录。
提供一种方式:人们能够并行的进行被分离的任务,而后再合并。
在没有其余的方式的时候,为开发人员提供一种协同工做的方式。
HOWTO 

怎样作呢

My goal for this series of articles is to help people learn how to do source control.  I work for SourceGear, a developer tools ISV.  We sell an SCM tool called Vault.  Through the experience of selling and supporting this product, I have learned something rather surprising:
个人目标就是帮助人们学习怎样作源码控制。我使用SourceGear来工做,这是一个独立软件开发商提供的开发者工具。咱们出售一种叫Vault的配置管理工具。经过对这个产品的出售和技术支持,我居然学到不少让人惊讶的东西。
 
Nobody is teaching people how to do source control.
没有人在教人们怎样作源码控制。
 
Our universities often don't teach people how to do source control.  We graduate with Computer Science degrees.  We know more than we'll ever need to know about discrete math, artificial intelligence and the design of virtual memory systems.  But many of us enter the workforce with no knowledge of how to use any of the basic tools of software development, including bug-tracking, unit testing, code coverage, source control, or even IDEs.
咱们的大学一般不会教咱们怎么作源码控制。咱们拥有计算机科学学位,咱们知道咱们曾被要求学离散数学、人工智能、虚拟存储器系统设计。大多数的咱们工做时都不具备怎样用一些基础的开发工具的知识,包括用缺陷追踪、单元测试、代码覆盖、配置管理,或者集成开发环境等等。
 
Our employers don't teach people how to do source control.  In fact, many employers provide their developers with no training at all.
咱们的雇主不会教咱们怎样进行源码控制。实际上,大多数的雇主都没有为员工提供培训。
SCM tool vendors don't teach people how to do source control.  We provide documentation on our products, but the help and the manuals usually amount to simple explanations of the program's menus and dialogs.  We sort of assume that our customers come to us with a basic background.
配置管理工具销售商不会教人们怎样作源码控制。咱们在产品里面提供文档,可是帮助和指南一般只是简单的解释产品的菜单和对话框。
咱们在必定程度上假设咱们的用户都是有必定技术背景的。
Here at SourceGear, our product is positioned specifically as a replacement for SourceSafe.  We assume that everyone who buys Vault already knows how to use SourceSafe.  However, experience is teaching us that this assumption is often untrue.  One of the most common questions received by our support team is from users asking for a solid explanation of the basics of source control.
这是SourceGear,咱们的产品是特殊定位的相似Sourcesafe的产品。咱们假设全部使用Vault的人都知道如何使用Sourcesafe。固然,经验告诉咱们假设仅仅是假设。最多见的是咱们的客户支持团队总收到一些常见的版本控制问题。
 
Best Practice:  Use source control
最佳实践:使用源码控制
Some surveys indicate that 70% of software teams do not use any kind of source control tool. I cannot imagine how they cope.
一些调查指出,有70%的软件团队没有使用任何类型的配置管理工具。我很难想象他们会怎样应付。
Throughout this series of articles, I will be sprinkling Best Practices that will appear in sidebar boxes like this one. These boxes will contain pithy and practical tips for developers and managers using SCM tools.
We need some materials that explain how source control is done.  My goal for this series of articles is to create a comprehensive guide to help meet this need.
在后面一系列文章里,我将将最佳实践像这个工具条盒子那样散布的显示。这些盒子将包含提供给开发人员和管理者使用配置管理工具的时候的一些精华和实践提示。
 
 
Somewhat tool-specific 

一些工具说明

Ideally, a series of articles on the techniques of source control would be tool-neutral, applicable to any of the available SCM tools.  It simply makes sense to teach the basic skills without teaching the specifics of any single tool.  We learn the basic skills of writing before we learn to use a word processor.
理想的来讲,关于源码控制的一系列技术文章应该是与工具无关的,能够适用于任何配置管理工具。简单的说就是只讲解版本控制或配置管理的流程或作法,而不是具体一个工具的使用。正像在咱们用一个词法处理器以前咱们须要学习基础的书写技巧同样。
However, in the case of SCM tools, this tool-agnostic approach is somewhat difficult to achieve.  Unlike writing, source control is simply not done without the assistance of specialized tools.  With no tools at all, the methods of source control are not practical.
固然,对于配置管理工具而言,不肯定工具的方向是有点难以达到的。不一样于书写,源码控制是必须借助特殊工具的。若是根本没有工具,源码控制的方法就难以实现。
Complicating matters further is the fact that not all source control tools are alike.  There are at least dozens of SCM tools available, but there is no standard set of features or even a standard terminology.  The word "checkout" has different meanings for CVS and SourceSafe.  The word "branch" has very different semantics for Subversion and PVCS.
更进一步复杂的情况是否是全部的源码控制工具都类似。市面上起码有一打的工具可使用,可是没有统一功能或标准化术语。好比“checkout”在CVSSourceSafe中的意义就不一样。“branch”在SubversionPVCS间有很是大的语义区别
 
So I will keep the tool-neutral ideal in mind as I write, but my articles will often be somewhat tool-specific.  Vault is the tool I know best, since I have played a big part in its design and coding.  Furthermore, I freely acknowledge that I have a business incentive to talk about my own product.  Although I will often mention other SCM tools, the articles in this series will use the terminology of Vault.
所以我在写这些文章的时候我尽力对工具保持理性中立的立场,可是个人文章又常常会写一点工具的细节。自从我将大部分的设计和编码放到里面开始,Vault是我知道的最好的工具。并且,我坦率地认可我有一个商业动机来描述我本身的产品。尽管我常常提到其余的配置管理工具,可是这系列文章仍是会用到Vault的术语。
 
The world's most incomplete list of SCM tools 
Several SCM tools that I mention in this series are listed below, with hyperlinks for more information.

此处列出当前世界上的部分配置管理工具

我在文章中提到的工具都列在下面,经过连接能够看到更多信息。
 
n          Vault.  Our product.  'Nuff said.
n          SourceSafe.  Microsoft.  Old.  Loved.  Hated.
n          Subversion.  Open source.  New.  Neato.
n          CVS.  Open source.  Old.  Reliable.  Dusty.
n          Perforce.  Commercial.  A competitor of SourceGear, but one that I admire.  (一个SourceGear的竞争对手,可是我很欣赏)
n          BitKeeper.  Commercial.  Uses a distributed repository architecture, so I won't be talking about this one much. (使用一个分布式数据库结构,因此我不会更多的谈及)
n          Arch.  Open source.  Distributed repository architecture.  Again, I spend most of my words here on tools with a centralized server. (分布式数据库结构,我花了不少的文字在采用集中式服务器的工具上)
This is a very incomplete list.  There are many SCM tools, and I am not interested in trying to produce and maintain and accurate listing of them all.
这仅仅是一个不彻底的列表。如今有不少的配置管理工具,我没有兴趣要去尝试维护和精确的列出他们。
 
 
Audience 

受众、读者

I am writing about source control for programmers and web developers.
我是在写关于程序员和web开发者如何作源码控制。
When we apply some of the concepts of source control to the world of traditional documents, the result is called "document management".  I'm not writing about any of those usage scenarios.
当咱们在传统的文档中应用源码控制的概念的时候,其结果是被称为“文档管理”。我不想写任何关于这方面的操做细节。
When we apply some of the concepts of source control to the world of graphic design, the result is called "asset management".  I'm not writing about any of those usage scenarios.
当咱们在传统的应用图形设计中应用源码控制的概念的时候,其结果是被称为“资产管理”。我也不是写此方面的操做细节。
My audience here is the group of people who deal primarily with source code files or HTML files.
个人读者是大量的使用源码文件或HTML文件的人。
 
Warnings about my writing style

关于个人书写风格的提示。

First of all, let me say a thing or two about political correctness.  Through these articles, I will occasionally find the need for gender-specific pronouns.  In such situations, I generally try to use the male and female variants of the words with approximately equal frequency.
首先,让我说一两件关于政治正确性的事情。在这些文章里,我一般发现须要一些性别代词。在有些状况下,我一般尝试使用男性和女性变量保持一个均衡的频率。
 
Discerning readers may notice my tendency to use female pronouns in examples which are positive and male pronouns in situations where the hypothetical person is a bonehead.  In part, I use this approach because it seems safer for me to aim my errors of political correctness in that direction.  I would also admit that this habit somewhat reflects my general belief that I was born a member of the gender which tends to evidence less character and virtue.
明眼的读者可能注意到个人趋势是在例子里面使用女性代名词表示积极的而男性在这种状况下被假设为笨蛋。部分地,我使用这种方式是尽可能使我在“政治”正确性上看起来要安全一些。
我认可这样作反映了个人通常见解,即我是一个在性别方面没有很强观点差异的人。
 
Second of all, please accept my apologies if my dry sense of humor ever becomes a distraction from the material.  I am writing about source control and trying to make it interesting.  That's like writing about sex and trying to make it boring, so please cut me some slack if I try to make you chuckle along the way.
第二,若是个人干涩的幽默成为了分散注意力的东西,请接受个人道歉。我正在写关于源码控制并试图使它变得有趣。这像描写性并使它变得讨厌,因此若是我试图使你发笑离开请你放我一马。
 

Looking Ahead  展望

Source control is a large topic, so there is much to be said.  I plan for the chapters of this series to be sorted very roughly from the very basic to the very advanced.  In the next chapter, I'll start by defining the most fundamental terminology of source control.
源码控制是一个大的课题,这能够有不少话说。我计划从基础到高级分类几率的表述。在下一个章节,我将开始定义关于源码控制的更多术语。
 
Best Practice:  Use source control

Some surveys indicate that 70% of software teams do not use any kind of source control tool. I cannot imagine how they cope.

Throughout this series of articles, I will be sprinkling Best Practices that will appear in sidebar boxes like this one. These boxes will contain pithy and practical tips for developers and managers using SCM tools.
 
 
原文出处
[url]http://software.ericsink.com/scm/scm_intro.html[/url]
相关文章
相关标签/搜索