我已经使用Subversion很多年了,在使用SourceSafe之后,我爱上了Subversion。结合TortoiseSVN,我真的无法想象它还能有什么更好的。
然而,越来越多的开发人员声称Subversion存在问题,我们应该转向新的分布式版本控制系统,比如Git。
Git如何改进Subversion?
我已经使用Subversion很多年了,在使用SourceSafe之后,我爱上了Subversion。结合TortoiseSVN,我真的无法想象它还能有什么更好的。
然而,越来越多的开发人员声称Subversion存在问题,我们应该转向新的分布式版本控制系统,比如Git。
Git如何改进Subversion?
当前回答
由于它不需要不断地与中央服务器通信,几乎每个命令都在不到一秒的时间内运行(显然git的push/pull/fetch较慢,因为它们必须初始化SSH连接)。分支要容易得多(一个简单的命令就可以分支,一个简单的命令就可以合并)
其他回答
谷歌技术讲座:Linus Torvalds谈git
http://www.youtube.com/watch?v=4XpnKHJAok8
Git Wiki的比较页面
http://git.or.cz/gitwiki/GitSvnComparsion
http://subversion.wandisco.com/component/content/article/1/40.html
我认为可以很有把握地说,在开发人员中,SVN和Git的争论已经激烈了一段时间,每个人都有自己的观点,哪个更好。这甚至在我们2010年及以后关于颠覆的网络研讨会的问题中被提出。
我们的开源和Subversion公司总统总监Hyrum Wright谈到了Subversion和Git之间的区别,以及其他分布式版本控制系统(DVCS)。
他还谈到了Subversion中即将发生的变化,比如下一代工作拷贝(WC-NG),他认为这会导致许多Git用户转换回Subversion。
请观看他的视频,并通过在这个博客上评论或在我们的论坛上发帖来告诉我们你的想法。注册很简单,只需要一点时间!
我最近一直住在Git的土地上,我喜欢用它来做个人项目,但是我还不能把工作项目从Subversion转换到Git上,因为它改变了工作人员的想法,而且没有紧迫的好处。此外,我们内部运行的最大项目非常依赖于svn:externals,从我目前所看到的来看,它在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.
This is the wrong question to be asking. It's all too easy to focus on git's warts and formulate an argument about why subversion is ostensibly better, at least for some use cases. The fact that git was originally designed as a low-level version control construction set and has a baroque linux-developer-oriented interface makes it easier for the holy wars to gain traction and perceived legitimacy. Git proponents bang the drum with millions of workflow advantages, which svn guys proclaim unnecessary. Pretty soon the whole debate is framed as centralized vs distributed, which serves the interests of the enterprise svn tool community. These companies, which typically put out the most convincing articles about subversion's superiority in the enterprise, are dependent on the perceived insecurity of git and the enterprise-readiness of svn for the long-term success of their products.
但问题是:Subversion是架构的死胡同。
Whereas you can take git and build a centralized subversion replacement quite easily, despite being around for more than twice as long svn has never been able to get even basic merge-tracking working anywhere near as well as it does in git. One basic reason for this is the design decision to make branches the same as directories. I don't know why they went this way originally, it certainly makes partial checkouts very simple. Unfortunately it also makes it impossible to track history properly. Now obviously you are supposed to use subversion repository layout conventions to separate branches from regular directories, and svn uses some heuristics to make things work for the daily use cases. But all this is just papering over a very poor and limiting low-level design decision. Being able to a do a repository-wise diff (rather than directory-wise diff) is basic and critical functionality for a version control system, and greatly simplifies the internals, making it possible to build smarter and useful features on top of it. You can see in the amount of effort that has been put into extending subversion, and yet how far behind it is from the current crop of modern VCSes in terms of fundamental operations like merge resolution.
现在,对于那些仍然相信Subversion在可预见的未来足够优秀的人,我有一个发自内心的不可知论的建议:
Subversion永远不会赶上从RCS和CVS的错误中吸取教训的新型vcs;这在技术上是不可能的,除非他们从头开始重新配置存储库模型,但这样就不是真正的SVN了,不是吗?不管你认为自己有多不具备现代VCS的能力,你的无知也无法保护你远离Subversion的陷阱,其中许多情况在其他系统中是不可能或很容易解决的。
It is extremely rare that the technical inferiority of a solution is so clear-cut as it is with svn, certainly I would never state such an opinion about win-vs-linux or emacs-vs-vi, but in this case it is so clearcut, and source control is such a fundamental tool in the developer's arsenal, that I feel it must be stated unequivocally. Regardless of the requirement to use svn for organizational reasons, I implore all svn users not to let their logical mind construct a false belief that more modern VCSes are only useful for large open-source projects. Regardless of the nature of your development work, if you are a programmer, you will be a more effective programmer if you learn how to use better-designed VCSes, whether it be Git, Mercurial, Darcs, or many others.