The difference between git and svn

Source: Internet
Author: User
Tags version control system

If you're reading this, you're interested in git just like most developers, and if you haven't had a chance to try Git, I think you need to get to know it now.

Git is not just a version control system, it is also a content management system (CMS), work management system and so on. If 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 in depth from SVN.

Well, here we go.

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

This is the core difference between git and other non-distributed version control systems, such as SVN,CVS. If you can understand this concept, then you are already half-done. There is a need to make a statement that Git is not the first or only distributed version control system. Other systems, such as BitKeeper, mercurial, and so on, are also running in distributed mode. But Git does better in this and has more powerful features.

GIT has its own centralized repository or server like SVN. However, Git prefers to be used in distributed mode, where each developer Chect out code from the central repository/server and clones a repository 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 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.

Similarly, 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 patch packs like you did before, send them by email, 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.

There are rumors that the future version of Subversion will also be based on distributed mode. But at least not yet.

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

All resource control systems hide the meta-information of files in a folder similar to. Svn,.cvs. If you compare the size of the. git directory with the. SVN, you will find that they are very different. Because the. Git directory is a cloned version of the repository on your machine that has everything on the central repository, such as tags, branches, release notes, and so on.

The 3.GIT branch differs from the SVN branch:

The branch is not special in SVN, it is another directory in the repository. If you want to know if a branch has been merged, you need to manually run a command like this, svn propget svn:mergeinfo, to verify that the code is merged. Thank Ben for pointing out this feature. Therefore, there are often cases where some branches are missing.

However, the branch that handles git is quite simple and interesting. You can quickly switch between several branches from the same working directory. You can easily find the branches that have not been merged, and you will be able to merge these files easily and quickly.

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

So far this is the biggest feature that git lacks in comparison with SVN. As you know, the SVN version number is actually a snapshot of the source code for any corresponding time. I think it's one of the biggest breakthroughs in the evolution from CVS to SVN. Because 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 point 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 number in 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 the code and ensures that the repository is compromised when disk failure and network problems are encountered. Here's a good discussion about git content integrity –http://stackoverflow.com/questions/964331/git-file-integrity

Finally provide a good tutorial site for git

http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000

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.