git学习(一)——了解版本控制系统

1、VCS (version control system)

版本控制系统。What is it and why should we care?

版本控制系统是一个系统,它记录一个文件或者一组文件随时间变化做出的改变。利用它,你可以找到特定的版本。

A VCS allows you to :

  revert files back to a previous state

  revert the entire project back to a previous state

  review changes made over time, see who last modified something that might be causing a problem, who introduced an issue and when, and more.

  generally recover the files you lost

简言之:恢复各个版本,追踪修改信息。这些操作的系统开销很小

2、popular vcs tools介绍

rcs: This tool basically works by keeping patch sets(that is, the differences between files) from one revision to another in a special format on disk; it can then recreate what any file looked like at any point in time by adding up all the patches

我的理解:保存各个版本之间的差别,以便恢复重创。这是比较老的,很简单,使用Lock机制防止多个开发人员对同一个文件同时进行修改。

问题在于:不能支持多个developers协同工作

于是产生了CVCS (Centralized VCS,集中式版本控制系统),代表者有CVS,SVN(subversion),Perforce

CVCS: 有一个单独的服务器,上面存着各个版本的文件。客户端从这个服务器上check out文件,这是很多年来标准的VCS 

缺点:必须连网才能提交改动;一旦中心服务器出现问题,那么所有的client都无法提交,若是中心服务器数据丢失,后果很严重;多个developers提交的时候,存在着速度竞争,若是别人比你快,可能会得到“改动基于过时的版本,先更新再提交” 诸如此类的提示。

注:其中的SVN貌似是目前使用最广泛的CVS,svn一个特点就是每个版本都有唯一的版本号,唯一的url,可以从这上面下载代码

GIT:GIT采用的是分布式版本控制系统。与集中式的区别在于,不仅server上面有版本库,每一个client本地也有一个版本库,这些版本库之间是平等的。

即本地有server的镜像,这个特点贡献了两个好处:

(1)开发者可以离线提交。所做的一切改动都可以先提交到本地库,等到有网的地方,再把本地库更新到server上

(2)因为绝大部分操作都是基于本地文件访问,所以速度非常快。

 Git 最为出色的是它的合并跟踪(merge tracing)能力

原文地址:https://www.cnblogs.com/hanying/p/3643050.html