版本控制Version control

版本控制系统用于管理各种不同版本中的文件,在软件开发中常常由多位开发者贡献。Version control is a system for managing files over many different versions, and - in software development - is generally contributed to by many developers. 任何版本控制系统 (VCS) 的主要目的都是找出一种解决方案,使所有用户都可同时对基本代码进行操作。The principal purpose of any version control system (VCS) is to find a solution that enables all users to work on the codebase at the same time.

而任何版本控制系统的核心都是存储库,它可充当所有不同文件的中央数据存储,与文件服务器类似。At the core of any version control system is a repository, which acts as the central data store for all the different files - similar to a file server. 但又不同于文件服务器,存储库包含项目的整个历史记录和所做的所有修订。However, unlike a file server, the repository contains the entire history of the project and all revisions that have been made.

如果存储库是中央数据存储,那么每个用户都具备一个可在其上操作的本地数据存储是完全合理的。If the repository is the central data store, it is logical for each user to have a local store of the data, allowing them to work on it. 这被称为“工作副本”。This is called a working copy. 在 Visual Studio for Mac 中,工作副本将显示在计算机上,就像任何其他本地目录一样,使用户可以从任意文件读取数据或将数据写入这些文件。In Visual Studio for Mac your working copy will appear just as any other local directory on your machine, allowing you to read from and write to any of the files. 但由于 Visual Studio for Mac 具有版本控制系统集成,因此可使用 Subversion 和 Git 而无需离开 IDE。However, because Visual Studio for Mac has Version control system integration, you can use Subversion and Git without leaving the IDE.

Subversion 是一个集中式版本控制系统,这表示,有一个服务器包含所有文件和修订,用户可从中签出任何文件的任何版本。Subversion is a centralized version control system, which means that there is a single server that contains all files and revisions from which users can check out any version of any file. 从远程 Subversion 存储库中签出文件时,用户将收到该时间点的存储库快照。When files are checked out from a remote Subversion repository, the user gets a snapshot of the repository at that point in time.

Git 是分布式版本控制系统,使团队可以同时在同一文档上工作。Git is a distributed version control system that allows teams to work on the same documents simultaneously. 使用 Git,可能有一个单一服务器包含所有文件,但从此中央源中签出存储库时,整个存储库都会被克隆到本地计算机。With Git there might be a single server that contains all the files, but the entire repository is cloned locally to your machine whenever a repository is checked out from this central source.

基本概念Basic Concepts

Visual Studio for Mac 支持 Git 和 Subversion 这两种版本控制系统。Visual Studio for Mac provides support for both Git and Subversion version control systems. 以下文章介绍了如何通过 Visual Studio for Mac 设置 Git 和 Subversion 存储库,以及简单的功能(如评审、提交和推送更改)。The following articles explore setting up Git and Subversion repositories through Visual Studio for Mac, as well as simple functionality such as reviewing, committing, and pushing changes.

另请参阅See also