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]
相關文章
相關標籤/搜索