版本控制系统(译文) 1 - 简介
翻译:只是路过, 校对:margiex
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”在CVS和SourceSafe中的意义就不同。“branch”在Subversion和PVCS间有非常大的语义区别
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.
原文出处
http://software.ericsink.com/scm/scm_intro.html