我已经使用Subversion很多年了,在使用SourceSafe之后,我爱上了Subversion。结合TortoiseSVN,我真的无法想象它还能有什么更好的。

然而,越来越多的开发人员声称Subversion存在问题,我们应该转向新的分布式版本控制系统,比如Git。

Git如何改进Subversion?


当前回答

Git和DVCS通常都非常适合于独立编写大量代码的开发人员,因为每个人都有自己的分支。但是,如果您需要从其他人那里进行更改,她必须提交给她的本地回购,然后她必须将该更改集推给您,或者您必须从她那里获取更改集。

我自己的推理也让我认为,如果你做集中发布之类的事情,DVCS会让QA和发布管理变得更加困难。必须有人负责从其他人的存储库中进行推送/拉取,解决任何在最初提交时就可以解决的冲突,然后进行构建,然后让所有其他开发人员重新同步他们的回购。

当然,所有这些都可以通过人工流程来解决;DVCS只是破坏了一些由集中式版本控制修复的东西,以便提供一些新的便利。

其他回答

Git还使分支和合并变得非常容易。Subversion 1.5刚刚添加了合并跟踪,但是Git仍然更好。使用Git进行分支是非常快速和廉价的。它使得为每个新特性创建分支更加可行。哦,与Subversion相比,Git存储库的存储空间非常有效。

http://subversion.wandisco.com/component/content/article/1/40.html

我认为可以很有把握地说,在开发人员中,SVN和Git的争论已经激烈了一段时间,每个人都有自己的观点,哪个更好。这甚至在我们2010年及以后关于颠覆的网络研讨会的问题中被提出。

我们的开源和Subversion公司总统总监Hyrum Wright谈到了Subversion和Git之间的区别,以及其他分布式版本控制系统(DVCS)。

他还谈到了Subversion中即将发生的变化,比如下一代工作拷贝(WC-NG),他认为这会导致许多Git用户转换回Subversion。

请观看他的视频,并通过在这个博客上评论或在我们的论坛上发帖来告诉我们你的想法。注册很简单,只需要一点时间!

一些回答已经提到了这些问题,但我想明确说明两点:

1)有选择性提交的能力(例如,git add——patch)。如果您的工作目录包含多个不属于同一逻辑更改的更改,Git可以很容易地提交只包含部分更改的提交。对于Subversion,这是很困难的。

2)在不公开更改的情况下提交的能力。在Subversion中,任何提交都是立即公开的,因此是不可撤销的。这极大地限制了开发人员“尽早提交,经常提交”的能力。

Git不仅仅是一个VCS;它也是一个开发补丁的工具。Subversion只是一个VCS。

由于它不需要不断地与中央服务器通信,几乎每个命令都在不到一秒的时间内运行(显然git的push/pull/fetch较慢,因为它们必须初始化SSH连接)。分支要容易得多(一个简单的命令就可以分支,一个简单的命令就可以合并)

“为什么Git比X好”概述了Git相对于其他scm的各种优缺点。

简要:

Git tracks content rather than files Branches are lightweight and merging is easy, and I mean really easy. It's distributed, basically every repository is a branch. It's much easier to develop concurrently and collaboratively than with Subversion, in my opinion. It also makes offline development possible. It doesn't impose any workflow, as seen on the above linked website, there are many workflows possible with Git. A Subversion-style workflow is easily mimicked. Git repositories are much smaller in file size than Subversion repositories. There's only one ".git" directory, as opposed to dozens of ".svn" repositories (note Subversion 1.7 and higher now uses a single directory like Git.) The staging area is awesome, it allows you to see the changes you will commit, commit partial changes and do various other stuff. Stashing is invaluable when you do "chaotic" development, or simply want to fix a bug while you're still working on something else (on a different branch). You can rewrite history, which is great for preparing patch sets and fixing your mistakes (before you publish the commits) … and a lot more.

有一些缺点:

There aren't many good GUIs for it yet. It's new and Subversion has been around for a lot longer, so this is natural as there are a few interfaces in development. Some good ones include TortoiseGit and GitHub for Mac. Partial checkouts/clones of repositories are not possible at the moment (I read that it's in development). However, there is submodule support. Git 1.7+ supports sparse checkouts. It might be harder to learn, even though I did not find this to be the case (about a year ago). Git has recently improved its interface and is quite user friendly.

在最简单的用法中,Subversion和Git是差不多的。两者之间没有太大区别:

svn checkout svn://foo.com/bar bar
cd bar
# edit
svn commit -m "foo"

and

git clone git@github.com:foo/bar.git
cd bar
# edit
git commit -a -m "foo"
git push

Git真正的亮点在于分支和与其他人一起工作。