Five basic differences between GIT and SVN

This article is reproduced, the original address is: http://www.oschina.net/news/12542/git-and-svn

 

Open source Chinese Git code hosting platform -  http://git.oschina.net

If you're reading this, you're as interested in GIT as most developers , and if you haven't had a chance to give it a try, I think you should now.

GIT is not just a version control system, it is also a content management system (CMS), work management system, etc. If you are someone with a background in using SVN, you will need to do some mental transformation to accommodate some of the concepts and features provided by GIT. So, the main purpose of this article is to help you understand what GIT can do and how it differs from SVN on a deep level.

Well, let's start...

 

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 BitkeeperMercurial , etc., which 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 stores the content as metadata, while SVN stores it as a file:

All resource control systems hide the file's meta information in a folder like .svn, .cvs, etc. If you compare the size of the .git directory with the size of the .svn, you will find that there is a big difference. Because, the .git directory is a cloned version of the repository on your machine, and it has everything on the central repository, such as tags, branches, version records, etc.

 

3. GIT branches and SVN branches are different:

A branch is nothing special in SVN, just another directory in the repository. If you want to know if a branch was merged, you need to manually run a command like svn propget svn:mergeinfo to confirm that the code was merged. Thanks to classmate Ben for pointing out this feature. Therefore, it often happens that some branches are missed.

However, dealing with branches in GIT is quite simple and fun. You can quickly switch between several branches from the same working directory. You can easily find unmerged branches, and you can merge these files easily and quickly.

Git logo

 

 

4.GIT does not have a global version number, while SVN has:

目前为止这是跟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

GIT和SVN之间只有这五处不同吗?当然不是。我想这5个只是“最基本的”“最吸引人”的,我只想到这5点。如果你发现有比这5点更有趣的,请共享出来,欢迎。

英文原文:5 Fundamental differences between GIT & SVN,编译:外刊IT评论

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326450872&siteId=291194637