Speaking of the difference between SVN and GIT

640?wx_fmt=png&wxfrom=5&wx_lazy=1

640?wx_fmt=png&wxfrom=5&wx_lazy=1


I have been looking through the information on the Internet in the past two days and found a very interesting thing. A post about SVN and GIT which is good or bad was published in 2015. There are still people leaving comments today, and the debate is really Extraordinarily hot.


For software developers, version control systems are all too familiar to them. The so-called version control system is the software used to store all revisions of the code written by developers during the development of a software project. At present, the common version control systems are divided into centralized version control system (SVN) and distributed version control system (GIT).


Regarding the advantages and disadvantages of the two, we have compiled some information on the Internet. Let's take a look and express your own opinions.


640?wx_fmt=gif&wxfrom=5&wx_lazy=1


1. GIT is distributed, SVN is not:


This is the core difference between GIT and other non-distributed version control systems, such as SVN, CVS, etc. If you can understand the concept, then you're halfway there. A little disclaimer, GIT is not the first or only distributed version control system out there. There are also some systems, such as Bitkeeper, Mercurial, etc., that also run in distributed mode. But GIT does this better and has more powerful features.


Like SVN, GIT has its own centralized repository or server. However, GIT is more inclined to be used in a distributed mode, that is, each developer will clone his own repository on his own machine after checking out the code from the central repository/server. Suffice it to say that if you're stuck somewhere with no internet connection, like on a plane, in a basement, in an elevator, etc., you'll still be able to commit files, view revision history, fork projects, etc. To some people, this may not seem like much use, but when you suddenly encounter an environment with no network, this will solve your big trouble.


Also, this distributed mode of operation is a huge boon for the development of the open source software community. You don't have to make a patch package and send it by email as before, you just need to create a branch and send it to the project team. Send a push request. This keeps your code up to date and not lost in transit. GitHub.com is a good example of this.


There are rumors that future versions of subversion will also be based on distributed mode. But at least not yet.


2. GIT把内容按元数据方式存储,而SVN是按文件:


所有的资源控制系统都是把文件的元信息隐藏在一个类似.svn,.cvs等的文件夹里。如果你把.git目录的体积大小跟.svn比较,你会发现它们差距很大。因为,.git目录是处于你的机器上的一个克隆版的版本库,它拥有中心版本库上所有的东西,例如标签,分支,版本记录等。


3. GIT分支和SVN的分支不同:


分支在SVN中一点不特别,就是版本库中的另外的一个目录。如果你想知道是否合并了一个分支,你需要手工运行像这样的命令svn propget svn:mergeinfo,来确认代码是否被合并。所以,经常会发生有些分支被遗漏的情况。


然而,处理GIT的分支却是相当的简单和有趣。你可以从同一个工作目录下快速的在几个分支间切换。你很容易发现未被合并的分支,你能简单而快捷的合并这些文件。


4. GIT没有一个全局的版本号,而SVN有:


目前为止这是跟SVN相比GIT缺少的最大的一个特征。你也知道,SVN的版本号实际是任何一个相应时间的源代码快照。我认为它是从CVS进化到SVN的最大的一个突破。因为GIT和SVN从概念上就不同,我不知道GIT里是什么特征与之对应。如果大家有好的线索,请在评论里奉献出来与大家共享。


有些人认为,我们可以使用GIT的SHA-1来唯一的标识一个代码快照。这个并不能完全的代替SVN里容易阅读的数字版本号。但,用途应该是相同的。


5. GIT的内容完整性要优于SVN:


GIT的内容存储使用的是SHA-1哈希算法。这能确保代码内容的完整性,确保在遇到磁盘故障和网络问题时降低对版本库的破坏。这里有一个很好的关于GIT内容完整性的讨论 –

http://stackoverflow.com/questions/964331/git-file-integrity


最后总结一下:


SVN的特点是简单,只是需要一个放代码的地方时用是OK的。


Git's feature version control can do anything without relying on the network, and has better support for branching and merging (of course, this is what developers care about most), but if you want to make better use of it, you need to spend some time trying it.


Are these five differences between GIT and SVN? of course not. I guess these 5 are just the "basic" and "most appealing", I only think of these 5. If you find something more interesting than these 5 points, please share it, welcome.


Comment area


@Ebel: I have used SVN for five years, GIT has also been used, each has its own advantages and disadvantages, as a comparison, it should be objective and real, not with strong emotional color, can not say that GIT is all advantages, and SVN is "dog" "Blood", it is best to ask your peers and friends to investigate whether more GIT or SVN is used in China's listed IT companies.


Donitry: Develop under windows, svn is indeed better. If it is under Linux, it is better to use git. The larger the number of teams, the greater the degree of cross-development, and the more obvious the benefits of git.


@大斌小江: I used SVN in the first year; when I switched to Git in the second and third years, it was difficult to understand at first. After I got used to it, I felt that it was really useful for development; in the fourth year, the new company used svn has been used for half a year, and I am ready to convert it to Git. I feel that both have their own advantages and disadvantages. For development, I think Git is easier to use.


@Michael_Fu: I have seen a lot of svn is worse than git, and I found out that svn is not that bad.


@白东风CAFEBABY: I feel a little unaccustomed to using git now, and if there are not too many collaborating people, the advantages of git will not be brought into play.



Officers, what do you think?


640?wx_fmt=gif

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326824860&siteId=291194637
Recommended