In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what is the difference between Git and SVN. The content of the article is of high quality. Therefore, Xiaobian shares it with you for reference. I hope you have a certain understanding of relevant knowledge after reading this article.
A storage method is different
Git stores a version of a file as metadata in a database similar to K/V, while SVN stores it as files. Git has an internal database similar to K/V, which I understand as a Map. After we store the content in Git's database, Git will return a Key to us. This Key is unique (upload the same content, and this key is unique). The demonstration is as follows:
Create a Git repository using the git init demo command.
2. Use cd demo to enter demo under this Git repository;
3. Use echo 'this is demo' >> demo.txt command to create a demo.txt file and write this is demo in the file; use ls command to see if there is demo.txt file; use vim demo.txt to see if there is 'this is demo';
4. Use git hash-object -w demo.txt command to store the contents of demo.txt file into Git database, where the value "25b3c07137f646bf05bdd00c42d2a4c5bc831bb7" in the second red box is the K returned to us by Git database;
5. The value can be taken out by git cat-file -p 25b3c07137f646bf05bdd00c42d2a4c5bc831bb7 command;
6, and then use the command to create a demo1.txt file, which also put in is "this is demo" to see if their K is the same;
This is how Git stores data. SVN is different. SVN stores data by copying files.
B is used differently.
To push a file locally to a remote service, SVN only needs to commit, while Git requires three steps: add, commit, and push.
SVN developers only need to modify the file, as long as commit other developers can directly checkout down. As shown below:
But Git is different. If Git wants to commit modified files from local to remote repository and then checkout modified files from other developers from remote repository, it needs the following steps:
1. First add the modified file to our temporary storage area by adding;
2. Then submit the files in the temporary storage area to the local repository through the commit command;
3. Finally, store the files in the local repository to the remote repository through the push command;
4. Pull the files from the remote repository to the local repository through the clone command;
5. Finally, take out the contents of the local repository through checkout;
The Git usage process is shown below:
C management model is different
Git is a distributed management system, SVN is a remote centralized management system.
If SVN's remote repository is dead, then my local project can no longer do commit, branch switch, and anything related to version management. This is the flaw of centralized management. The centralized management mode is shown in the following figure:
There is a Git repository within the project, which means that a local project contains a complete Git repository. The Git repository is within the project, and the local Git repository can do what the remote repository can do. Local and remote repositories are linked by four main transport protocols (Native Protocol, Http Protocol, SSH Protocol, Git Protocol). Git also supports multiple remote repositories within a remote repository.
What is the difference between Git and SVN is shared here, I hope the above content can be of some help to everyone and learn more knowledge. If you think the article is good, you can share it so that more people can see it.
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.