In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you what are the differences between GIT and SVN comparison, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
GIT is not only a version control system, it is also a content management system (CMS), work management system and so on. If you are a person with a background in using SVN, you need to make some thought changes to adapt to some of the concepts and features provided by GIT. So the main purpose of this article is to help you understand it by introducing what GIT can do and how it differs from SVN at a deep level.
one。 GIT is distributed, 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 in the middle of it. Just to be clear, GIT is not the first or only distributed version control system currently available. Other systems, such as Bitkeeper, Mercurial, etc., also run in distributed mode. But GIT is better at this and has more powerful features.
Like SVN, GIT has its own centralized version library or server. However, GIT is more likely to be used in a distributed mode, where each developer clones their own version library on their own machine after chect out code from the central version library / server. It can be said that if you are stuck in a place where you can't connect to the Internet, like on a plane, basement, elevator, etc., you can still submit documents, view historical versions, create project branches, and so on. To some people, this doesn't seem to be of much use, but when you suddenly run into an environment without the Internet, it will solve your big problem.
Similarly, this distributed mode of operation is a huge boon to the development of the open source software community. You don't have to make a patch pack and send it through email as before, you just need to create a branch and send a push request to the project team. This keeps your code up-to-date and won't be lost during transmission. GitHub.com is such an excellent example.
There are rumors that future versions of subversion will also be based on distributed mode. But at least not yet.
two。 GIT stores content as metadata, while SVN stores content by file:
All resource control systems hide the meta-information of files in a folder such as .svn, .cvs, etc. If you compare the size of the .git directory with that of .svn, you will find that there is a big difference between them. Because the .git directory is a cloned version library on your machine, it has everything on the central version library, such as tags, branches, version records, etc.
three。 The GIT branch is different from the SVN branch:
Branches are nothing special in SVN, just another directory in the version library. If you want to know if a branch has been merged, you need to manually run the command svn propget svn:mergeinfo like this to confirm that the code has been merged. Thank you, Ben, for pointing out this feature. Therefore, some branches are often omitted.
However, dealing with the branches of GIT is quite simple and interesting. 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.
four。 GIT does not have a global version number, while SVN has:
This is by far the biggest feature that GIT lacks compared to SVN. As you know, the version number of SVN is actually a snapshot of the source code at any corresponding time. I think it's the biggest breakthrough in evolution from CVS to SVN. Because GIT and SVN are conceptually different, I don't know what features correspond to them in GIT. If you have any clues, please give them in the comments and share with you.
Update: some readers have pointed out that we can use GIT's SHA-1 to uniquely identify a code snapshot. This is not a complete substitute for the easy-to-read digital version number in SVN. However, the use should be the same.
five。 GIT has better content integrity than SVN:
GIT's content storage uses the SHA-1 hash algorithm. This ensures the integrity of the code content and reduces damage to the version library in the event of disk failures and network problems. Here is a good discussion about the content integrity of GIT-http://stackoverflow.com/questions/964331/git-file-integrity
Are there only five differences between GIT and SVN? Of course not. I think these five are only the "most basic" and "most attractive".
An introduction to the difference between git and svn
Why version control is needed
Both git and svn are used by programmers to manage code. If you develop a project by yourself, you don't need version control at all, right? However, it is almost impossible for a person to be responsible for a project in an enterprise, from requirements review, UI design, front-end development, background development, testing, the whole process requires the cooperation of a team. At this time, version control is particularly important.
Difference
Let's talk about the difference between git and svn:
Svn is a centralized version control system and git is a distributed version control system.
I do not know how many people have heard this sentence, what is centralized and what is distributed? Obviously, literally, svn means that everyone modifies the program on the server, and if someone modifies the same part, it will conflict. Therefore, the general team will agree that for the common part of the program, try to mark the developer-specific logo, or A from the top to add, B from the bottom.
Git is for developers to create their own branches. This branch is equivalent to putting a copy of the source code copy on the local machine, and then modifying the local code, you can pull the server's code for synchronization at any time. Git can create numerous branches, and developers only need to submit their modified code, so the chance of conflict will be much less.
Svn interacts directly with the server, and git caches the project locally and then pushes it to the server.
Svn must work on the Internet, but git can not be developed on the Internet.
Svn is easy to conflict, but git is not easy to conflict.
Svn is for project management, and git is for code management.
Svn is suitable for multi-project parallel development, and git is suitable for single project development.
Svn is suitable for the enterprise, the project manager coordinates the overall development of multiple projects, and git is suitable for the development of the same project by multiple people through the network.
Git and github
Make a sentence to reflect the relationship between the two.
Mio submitted the project to github using git
In other words: git is a tool, github is a platform.
Last
I don't know who I heard before, but the meaning of writing a technology blog is not to remember, but to teach. This sentence is really reasonable. Although the words written now are very unprofessional and look like laymen, I will try my best.
The following is the supplement of Mr. Bai Pao.
The first rule of understanding will be targeted only when the idea is in place, and the others can only be realized when they are used.
1) the core difference Git is distributed, while Svn is not distributed. To understand this, it will be easy to declare that Git is not the only distributed version control system at present, such as Mercurial, etc., so they are not much different. In other words, like Svn, Git has its own centralized version library and server, but Git is more inclined to distributed development, because every developer has a Local Repository on his computer, so you can Commit, view historical versions, create item branches, and so on, even if there is no network, and wait for the network to connect Push to the server again.
From above, GIt is really great, but GIt adds Complexity will be a little confusing at first, because you need to build two Repositories (Local Repositories & Remote Repositories). There are a lot of instructions. Besides, you need to know which instructions are in Local Repository and which instructions are in Remote Repository.
2) Git stores content as metadata, while SVN stores content by file: because the .git directory is a cloned version library on your machine, it owns everything on the central version library, such as tags, branches, version records, etc. Comparing the size of the .git directory with that of .svn, you will find that there is a big difference between them.
3) Git does not have a global version number, while SVN does: this is by far the biggest feature that Git lacks compared to SVN.
4) the content integrity of Git is better than that of SVN: the content storage of GIT uses SHA-1 hash algorithm. This ensures the integrity of the code content and reduces damage to the version library in the event of disk failures and network problems.
5) after downloading the Git, you can see all the Log,SVN disallowed in OffLine.
6) at the beginning of the use of a very bloody point, SVN must first Update before Commit, forget that there will be some errors when merging, git is still relatively rare.
7) to clone an entirely new directory with five branches, SVN is to repeat five versions of files at the same time, that is, to repeat the same action five times. While Git just took the elements of each version of the file, and then loaded only the main branches (master) in my experience, it took nearly an hour to clone a SVN with nearly 10, 000 commit and five branches, each with about 1500 files! And Git only took a minute!
8) repository: SVN can only have one specified central version library. When there is a problem with the central version library, all working members are paralyzed together until the version library has been repaired or a new version library has been set up. Git can have an unlimited library of versions. Or, more accurately, every Git is a version library, the difference being whether they have an active directory (Git Working Tree). If something happens to the major version library (for example, the version library placed in GitHub), the working members can still submit it in their own local version library (local repository) and wait for the major version library to be restored. Staff members can also submit to other version libraries!
9) Branch is in SVN, and the branch is a complete directory. And this directory has the complete actual file. If staff members want to open new branches, it will affect the whole world! Everyone will have the same branch as you. If your branch is used for sabotage work (security testing), it will be like an infectious disease, you change a branch, and you have to ask others to cut the branch and download it again. On the other hand, Git, each working member can open unlimited branches in his own local version library. For example: when I want to try to break my own program (security tests) and want to keep these modified files for future use, I can open a branch and do what I like. There is no need to worry about interfering with other working members. As long as I do not merge and submit to the main version library, no member of the staff will be affected. When I don't need this branch, I just need to remove it from my local version library. No pain, no itching.
Different names can be used for the branch names of Git. For example, my local branch is called OK, while the name in the main version library is actually master.
Most notably, I can open a branch at any of the submission points (commit point) of Git! One way is to use gitk-all to view the entire submission record, and then open the branch at any point. )
10) Commit in SVN, when you submit your finished product, it will be recorded directly to the central repository. When you find that there is a serious problem with your finished product, you can no longer stop it from happening. If the network is down, you won't be able to submit it at all! The submission of Git is entirely an activity of the local version library. All you have to do is "git push" to the major version library. Git's "push" is actually performing "Sync".
Finally, let's sum up:
The characteristic of SVN is simple, but it is OK when you need a place to put the code.
Git features version control that does not rely on the network to do anything, and has better support for branching and merging (of course, this is what developers are most concerned about), but it will take some time to try it.
These are all the contents of this article entitled "what are the differences between GIT and SVN?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.