我正在开始一个新的分布式项目。我应该使用SVN还是Git,为什么?
当前回答
这是我在2009年9月删除Git vs. SVN的问题后,对一些重复问题的回答的副本。
更好吗?除了通常的WhyGitIsBetterThanX链接外,它们是不同的:
一个是基于分支和标记的廉价拷贝的中央VCS 另一个(Git)是基于修订图的分布式VCS。 参见VCS的核心概念。
第一部分产生了一些错误的评论,假装这两个程序(SVN和Git)的基本目的是相同的,但它们的实现却截然不同。 为了澄清SVN和Git之间的根本区别,让我重新表述一下:
SVN is the third implementation of a revision control: RCS, then CVS and finally SVN manage directories of versioned data. SVN offers VCS features (labeling and merging), but its tag is just a directory copy (like a branch, except you are not "supposed" to touch anything in a tag directory), and its merge is still complicated, currently based on meta-data added to remember what has already been merged. Git is a file content management (a tool made to merge files), evolved into a true Version Control System, based on a DAG (Directed Acyclic Graph) of commits, where branches are part of the history of datas (and not a data itself), and where tags are a true meta-data.
说他们没有“根本”不同,因为你可以实现同样的事情,解决同样的问题,是……在很多层面上都是错误的。
if you have many complex merges, doing them with SVN will be longer and more error prone. if you have to create many branches, you will need to manage them and merge them, again much more easily with Git than with SVN, especially if a high number of files are involved (the speed then becomes important) if you have partial merges for a work in progress, you will take advantage of the Git staging area (index) to commit only what you need, stash the rest, and move on on another branch. if you need offline development... well with Git you are always "online", with your own local repository, whatever the workflow you want to follow with other repositories.
然而,对那个旧答案(已删除)的评论坚持认为:
冯克:你混淆了执行上的根本差异(这种差异是非常根本的,我们显然都同意这一点)和目的上的差异。 它们都是用于相同目的的工具:这就是为什么许多以前使用SVN的团队能够相当成功地抛弃SVN,转而使用Git的原因。 如果他们不解决同一个问题,这种可替代性就不会存在。
,我回答说:
“可代换性”……有趣的术语(用于计算机编程)。 当然,Git并不是SVN的子类型。
您可以使用这两种工具实现相同的技术特性(标记、分支、合并),但是Git不会妨碍您,它允许您专注于文件的内容,而不用考虑工具本身。
你当然不能(总是)用Git替换SVN,“而不改变该程序的任何可取属性(正确性、执行的任务……)”。(引用了前面提到的可替代性定义):
One is an extended revision tool, the other a true version control system. One is suited small to medium monolithic project with simple merge workflow and (not too much) parallel versions. SVN is enough for that purpose, and you may not need all the Git features. The other allows for medium to large projects based on multiple components (one repo per component), with large number of files to merges between multiple branches in a complex merge workflow, parallel versions in branches, retrofit merges, and so on. You could do it with SVN, but you are much better off with Git. SVN simply can not manage any project of any size with any merge workflow. Git can.
同样,它们的本质是不同的(这会导致不同的实现,但这不是重点)。 一个将修订控制视为目录和文件,另一个仅看到文件的内容(以至于空目录甚至不会在Git中注册!)
一般的最终目标可能是相同的,但您不能以相同的方式使用它们,也不能解决相同类型的问题(在范围或复杂性方面)。
其他回答
你试过Bzr吗?
这很好,cononical(制作Ubuntu的人)制作它是因为他们不喜欢市场上的其他东西……
我会选择SVN,因为它传播更广泛,知名度更高。
我想Git更适合Linux用户。
我会设置一个Subversion存储库。通过这种方式,个人开发人员可以选择是使用Subversion客户机还是Git客户机(使用Git -svn)。使用Git -svn不能为您提供完整Git解决方案的所有好处,但它确实为单个开发人员提供了对自己的工作流的大量控制。
我相信Git在Windows上的表现会在相对较短的时间内达到在Unix和Mac OS X上的效果(既然你问了)。
Subversion为Windows提供了出色的工具,例如用于浏览器集成的TortoiseSVN和用于Visual Studio集成的AnkhSVN。
SVN的2个主要优点很少被提及:
Large file support. In addition to code, I use SVN to manage my home directory. SVN is the only VCS (distributed or not) that doesn't choke on my TrueCrypt files (please correct me if there's another VCS that handles 500MB+ files effectively). This is because diff comparisons are streamed (this is a very essential point). Rsync is unacceptable because it's not 2-way. Partial repository (subdir) checkout/checkin. Mercurial and bzr don't support this, and git's support is limited. This is bad in a team environment, but invaluable if I want to check something out on another computer from my home dir.
只是我的经验。
YouTube上有一个关于这个的有趣视频。这句话出自莱纳斯·托瓦尔兹本人:google Tech Talk:莱纳斯·托瓦尔兹谈git
推荐文章
- Visual Studio代码如何解决合并冲突与git?
- 无法推送到远程分支,无法解析到分支
- Git:如何将数据库重置为特定的提交?
- 如何在合并期间使用Git和命令行保存本地文件或远程文件?
- 能够用一个命令推到所有git遥控器?
- 重新基于Git合并提交
- 忽略已经签入目录的内容?
- 如何完全删除TFS绑定
- 哪些Eclipse文件属于版本控制?
- 如何从windows cmd保存git提交消息?
- (Mac) -bash: __git_ps1:命令未找到
- 如何删除多个已删除的文件在Git仓库
- 使用vimdiff查看所有' git diff '
- 如何拉特定的目录与git
- 命令行svn for Windows?