跟踪更改 SVN 与 Git

Tracking changes SVN vs Git

在观看有关 Lynda.com 的关于分布式版本控制系统与集中式版本控制系统的教程时,我看到一些文字让我感到困惑 Git 跟踪与集中式版本控制系统有何不同。我一直认为提到的 VCS 正在跟踪更改,并且在提交时将这些更改的快照保存到用于从版本到版本获取的存储库中。但出于某种原因,以下文本声称 Git 不能以这种方式工作。

谁能帮我解释清楚一下?

In Git the changes are stored as change sets or patches, and we're focused on tracking changes not the versions of the document. Now that's a subtle difference, you may think, well, CVS and SVN those track changes too, they don't. They track the changes that it takes to get from version-to-version of each of the different files or the different states of a directory. Git doesn't work that way, Git really focuses on these change sets in encapsulating a change set as a discrete unit and then those change sets can be exchanged between repositories. We're not trying to keep up-to-date with the latest version of something instead the question is, do we have a change set applied or not?

在 CVCS 中,更改是围绕单个中央存储库同步的。因此,提交更改后,用户会在该存储库中为其他人创建一个版本。

虽然在 DVCS 中,每个用户都有自己独立的存储库副本,并且所有变更集(或提交)最初都放在此处。有一个使用 fetch/push 命令在其他用户存储库之间同步更改的单独过程。

本教程错误严重:

  1. Git 存储变更集。 Git 根据请求动态计算 变更集。 (Git 确实在包文件中进行增量压缩,但与 Git 的对象存储模型相比,包文件隐藏得相当好,后者是通过哈希 ID 故意暴露的。)
  2. 在讨论分布式与集中式时,这不是一个有用的区别。 (另见 。)

以下是我在自己的书中对分布式与集中式的看法:

The key difference between these two kinds of systems is that a centralized VCS has a designated master repository. There may be multiple copies of the master, or even multiple masters with some kind of synchronization protocol (e.g., ClearCase MultiSite), but there is only one master. Their design assumes this single-master-ship and thus is allowed to depend on it.

With a distributed VCS, there is no designated master repository. Users generally have a complete, private copy of each repository. Communications between these private copies are, at least in principle, peer-to-peer operations: neither repository is any more masterful, and conflicts—situations where both Alice and Bob have made changes to the same regions of the same files—can and do occur and require some kind of resolution.

It’s always possible to use a distributed VCS in a centralized manner: you simply designate one particular repository as the master version, and coordinate updates to it. However, centralized systems often provide features like locking source files or directories, restricting access (for read and/or write, to particular files, directories, and/or branches), and so on. With a typical DVCS it’s more difficult (though not technically impossible) to provide these, and Git and Mercurial simply don’t, at least not without add-ons. With CVCSes that provide locking, users may lock files (typically just one specific version ID) to prevent other users from making conflicting changes. This is conceptually easier, but of course it can prohibit parallel work.