The difference between git and svn

Source: Internet
Author: User

Let's say you're reading this article and you're interested in git just like most developers, assuming you haven't had a chance to try Git, I think you're going to get to know it now.

GIT is no more than a version number control system, it is also a content management system (CMS), work management system and so on. Suppose you are a person with an SVN background, you need to do some thinking to adapt to some of the concepts and features that Git offers. So, the main purpose of this article is to help you get to know it by describing what git can do, and how it differs from SVN in depth.

The 1.GIT is distributed, and SVN is not:

This is the core difference between git and other non-distributed version number control systems, such as SVN,CVS. Assuming you can understand the concept, you're halfway through. There is a need to make a statement that Git is not the first or only distributed version number control system. Other systems, such as bitkeeper, mercurial, etc., are also implemented in distributed mode. But Git does better in this and has a lot of other powerful features.

GIT has its own centralized version number library or server like SVN. However, git is more inclined to be used in distributed mode, where each developer Chect out code from the central version library/server and clones a version number library on its own machine. It can be said that if you are trapped in a place where you can't connect to a network, like on a plane, basement, elevator, etc., you can still submit files, view historical version number records, create project branches, and so on. For some people, this doesn't seem like much use, but when you suddenly encounter a network-free environment, this will solve your big problem.

In the same way, this distributed mode of operation is a huge boon for the development of the open-source software community, and you don't have to make a patch and send it by email as you once did, you just need to create a branch and send a push request to the project team. This will keep your code up-to-date and will not be lost during the transfer process. Github.com is such a good case.

Some rumors come out that subversion's future version numbers will also be based on distributed mode. But at least not at the moment.

2.GIT stores content as metadata, and SVN is file-based:

All of the resource control system is to hide the file meta-information in a similar. Svn,.cvs folder. Suppose you compare the size of the. git folder to. SVN, and you will find that they are very different. Because the. Git folder is a cloned version of the repository on your machine, it has everything in the central version number, such as tags, branches, version numbers, and so on.

The 3.GIT branch differs from the SVN branch:

The branch is not special in SVN, it is another folder in the version number library. Assuming you want to know if a branch is merged, you need to manually execute an svn propget svn:mergeinfolike this command to confirm that the code is merged. Thank Ben for pointing out this feature. So, there are often cases where some branches are missing.

However, the branch that handles git is quite simple and interesting. You can switch between several branches at a high speed from the same working folder. You are very easy to find branches that have not been merged, you can easily and quickly merge these files.

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

So far this is the biggest feature that git lacks in comparison with SVN. As you know, the SVN version is actually a snapshot of the source code regardless of the corresponding time. I think it's one of the biggest breakthroughs in the evolution from CVS to SVN. Since git and svn are conceptually different, I don't know what features in git correspond to them. If you have any clues, please share them with you in the comments.

Update: Some readers have pointed out that we can use Git's SHA-1 to uniquely identify a code snapshot. This does not completely replace the easy-to-read digital version of SVN. However, the use should be the same.

5.GIT content Integrity is superior to SVN:

Git's content store uses the SHA-1 hashing algorithm. This ensures the integrity of the content of your code and ensures that you reduce the damage to the version number library when you encounter disk failures and network problems. Here's a very good discussion about git content integrity –http://stackoverflow.com/questions/964331/git-file-integrity


The difference between git and svn

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.