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

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

Git如何改进Subversion?


当前回答

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

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

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

其他回答

我认为Subversion很好。直到你开始合并…或者做任何复杂的事情。或者做任何Subversion认为复杂的事情(比如查询哪些分支弄乱了特定的文件,更改实际上来自哪里,检测复制和粘贴,等等)…

我不同意获胜的答案,我认为GIT的主要好处是离线工作——它当然有用,但它更像是我的用例的额外功能。SVK也可以离线工作,对我来说,把我的学习时间投入到哪一个是没有问题的)。

只是它非常强大、快速,而且——在习惯了这些概念之后——非常有用(是的,在这个意义上:用户友好)。

有关合并故事的更多细节,请参见: 使用git-svn(或类似)*只是*帮助svn合并?

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

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

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

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

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

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

其他的回答很好地解释了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.

我非常喜欢能够在Git中管理源代码的本地分支,而不会混淆中央存储库的水。在许多情况下,我将从Subversion服务器签出代码并运行本地Git存储库,只是为了能够做到这一点。初始化Git存储库不会因为到处都是烦人的.svn文件夹而污染文件系统,这一点也很棒。

至于Windows工具的支持,TortoiseGit处理基本的很好,但我仍然喜欢命令行,除非我想查看日志。我真的很喜欢Tortoise{Git|SVN}在读取提交日志时的帮助方式。

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

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

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