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

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

Git如何改进Subversion?


当前回答

其他的回答很好地解释了Git的核心特性(这些特性非常棒)。但是还有很多小方法可以让Git表现得更好,并帮助我的生活更加理智。以下是一些小细节:

Git has a 'clean' command. SVN desperately needs this command, considering how frequently it will dump extra files on your disk. Git has the 'bisect' command. It's nice. SVN creates .svn directories in every single folder (Git only creates one .git directory). Every script you write, and every grep you do, will need to be written to ignore these .svn directories. You also need an entire command ("svn export") just to get a sane copy of your files. In SVN, each file & folder can come from a different revision or branch. At first, it sounds nice to have this freedom. But what this actually means is that there is a million different ways for your local checkout to be completely screwed up. (for example, if "svn switch" fails halfway through, or if you enter a command wrong). And the worst part is: if you ever get into a situation where some of your files are coming from one place, and some of them from another, the "svn status" will tell you that everything is normal. You'll need to do "svn info" on each file/directory to discover how weird things are. If "git status" tells you that things are normal, then you can trust that things really are normal. You have to tell SVN whenever you move or delete something. Git will just figure it out. Ignore semantics are easier in Git. If you ignore a pattern (such as *.pyc), it will be ignored for all subdirectories. (But if you really want to ignore something for just one directory, you can). With SVN, it seems that there is no easy way to ignore a pattern across all subdirectories. Another item involving ignore files. Git makes it possible to have "private" ignore settings (using the file .git/info/exclude), which won't affect anyone else.

其他回答

Windows中的Git现在得到了很好的支持。

查看GitExtensions = http://code.google.com/p/gitextensions/

以及更好的Windows Git体验的手册。

这里所有的答案都是意料之中的,以程序员为中心,但是如果你的公司在源代码之外使用修订控制会发生什么呢?有很多文档不是源代码,它们受益于版本控制,应该与代码接近,而不是在另一个CMS中。大多数程序员都不是孤立地工作——我们作为团队的一部分为公司工作。

考虑到这一点,比较Subversion和git在客户端工具和培训方面的易用性。我看不出有哪一种分布式修订控制系统会更容易使用或向非程序员解释。我很乐意被证明是错误的,因为这样我就可以评估git,并希望它能够被那些需要版本控制的人(而不是程序员)接受。

即便如此,如果管理层问我为什么我们应该从集中式版本控制系统转向分布式版本控制系统,我也很难给出一个诚实的答案,因为我们不需要它。

Disclaimer: I became interested in Subversion early on (around v0.29) so obviously I'm biased, but the companies I've worked for since that time are benefiting from my enthusiasm because I've encouraged and supported its use. I suspect this is how it happens with most software companies. With so many programmers jumping on the git bandwagon, I wonder how many companies are going to miss out on the benefits of using version control outside of source code? Even if you have separate systems for different teams, you're missing out on some of the benefits, such as (unified) issue tracking integration, whilst increasing maintenance, hardware and training requirements.

这一切都是关于做某事所需的易用性/步骤。

如果我在我的PC/笔记本电脑上开发一个项目,git会更好,因为它的设置和使用要容易得多。 合并时不需要服务器,也不需要一直输入存储库URL's in。

如果只有两个人,我会说git也更简单,因为你可以互相推拉。

一旦你超越了这一点,我就会选择颠覆,因为在这一点上你需要设置一个“专用”服务器或位置。

使用git可以像使用SVN一样做到这一点,但是git的好处被需要执行额外步骤来与中央服务器同步所抵消。在SVN中,你只需要提交。在git中,你必须先执行git commit,然后再执行git push。额外的步骤很烦人,因为你最后做了太多。

SVN也有更好的GUI工具的好处,但是git生态系统似乎正在迅速追赶,所以从长远来看我并不担心这一点。

我喜欢Git,因为它实际上有助于在中大型团队中开发人员之间的沟通。作为一个分布式版本控制系统,通过它的推送/拉系统,它帮助开发人员创建一个源代码生态系统,这有助于管理在单个项目上工作的大量开发人员。

例如,假设你信任5个开发人员,并且只从他们的存储库中提取代码。每个开发人员都有自己的信任网络,从那里提取代码。因此,开发是基于开发人员之间的信任结构,其中代码责任由开发社区共享。

当然,在这里的其他答案中也提到了其他好处。

我最近一直住在Git的土地上,我喜欢用它来做个人项目,但是我还不能把工作项目从Subversion转换到Git上,因为它改变了工作人员的想法,而且没有紧迫的好处。此外,我们内部运行的最大项目非常依赖于svn:externals,从我目前所看到的来看,它在Git中并不能很好地无缝工作。