Home  >  Article  >  Development Tools  >  What are git and svn

What are git and svn

青灯夜游
青灯夜游Original
2021-11-30 14:09:445799browse

Git is an open source distributed version control system, used to effectively and quickly handle version management of projects from small to very large. svn is an open source centralized version control system that is used by multiple people to jointly develop the same project, realize shared resources, and ultimately achieve centralized management.

What are git and svn

The operating environment of this tutorial: Windows 7 system, Git version 2.30.0, Dell G3 computer.

What is git

Git is a free, open source distributed version control system for agile and efficient processing of any or small tasks. Or large projects

Git is an open source distributed version control system, used to effectively and quickly handle version management of projects from small to very large. Git is an open source version control software developed by Linus Torvalds to help manage Linux kernel development.

The biggest difference between distributed and centralized is that developers can submit locally, and each developer copies a complete Git repository on the local machine through cloning (git clone).

Git is a distributed version control system

2 (1).png

Git has the following characteristics:

  • The repository of each clone in Git is equal. You can clone any repository to create your own repository, and your repository can also be used as a source for others if you wish.

  • Every extraction operation of Git is actually a complete backup of the code repository.

  • Submission is completely completed locally, no one else needs to give you authorization, you are the master of your repository, and the submission will always be successful.

  • Even changes based on the old version can be submitted successfully, and the submission will create a new branch based on the old version.

  • Git submission will not be interrupted until you are completely satisfied with your work. PUSH to others or others to PULL your repository. Merging will occur during the PULL and PUSH processes. Conflicts that cannot be resolved automatically will prompt you to complete them manually.

  • Conflict resolution is no longer like a submission competition like SVN, but merging and conflict resolution are performed when needed.

  • Git can also simulate a centralized working mode

  • The Git version library is unified on the server

  • You can authorize the Git repository: who can create the repository, who can PUSH to the repository, and who can read (clone) the repository

  • Members of the team first Clone the server's repository locally; and frequently pull (PULL) the latest updates from the server's repository;

  • Team members push (PUSH) their changes to the server's repository In the repository, when others synchronize with the repository (PULL), changes will be automatically obtained

  • Git’s centralized working model is very flexible

  • You can completely disconnect from the network where the Git server is located, such as when working on the move/on a business trip, and still use the code library as usual

  • You only need to be able to access the network where the Git server is located , PULL and PUSH can complete synchronization with the server and submit

  • Git provides the rebase command, which can make your changes appear to be based on the latest code implementation

  • Git has more working modes to choose from than Subversion

What is svn

SVN is the abbreviation of subversion. It is an open source version control system. Through the efficient management of the branch management system, in short, it is used for multiple people to jointly develop the same project, achieve shared resources, and achieve final concentration. style management.

SVN manages data that changes over time. This data is placed in a central repository. This archive is much like a regular file server, but it remembers every file change. This way you can restore the file to an older version or browse the file's change history. Subversion is a general-purpose system that can be used to manage any type of file, including program source code.

SVN is a centralized version control system.

A centralized version control system has a single centralized management server that saves the revisions of all files, and people working together connect to this server through the client and retrieve the latest File or submit an update.

1 (1).png

The characteristics of svn can be summarized as follows:

  • Each repository has a unique URL (official address) , each user obtains code and data from this address;

  • To obtain code updates, they can only connect to this unique version library and synchronize to obtain the latest data;

  • Submissions must have a network connection (non-local repository);

  • Submission requires authorization. If there is no write permission, submission will fail;

  • Submission may not be successful every time. If someone else submits before you, it will prompt "The changes are based on an outdated version, update first and then submit"... and so on;

  • Conflict resolution is a competition of submission speed: those who are quick, Submit first, and nothing will happen; if you are slow, submit later, you may encounter troublesome conflict resolution.

Benefits: Everyone can see to some extent what others in the project are working on. Administrators can also easily control the permissions of each developer.

Disadvantages: Single point of failure of the central server.

If it is down for one hour, no one will be able to submit updates, restores, comparisons, etc. within this hour, and it will be impossible to work together. If the central server's disk fails and no backup is made or the backup is not timely enough, there is a risk of data loss. The worst case scenario is to completely lose all historical change records of the entire project, except for some snapshot data extracted by the client, but this is still a problem because you cannot guarantee that all the data has been extracted.

In principle, svn only cares about the specific differences in file content. Each time it is recorded which files have been updated, and which lines and contents have been updated.

The difference in the applicable scope of svn and git

  • The applicable objects are different.

    Git is suitable for developers involved in open source projects. Because of their high level of expertise, they care more about efficiency than ease of use. SVN is different, it is suitable for ordinary company development teams. It's easier to use.

  • The occasions used are different.

    Git is suitable for the development of a single project with multiple development roles through the Internet, and SVN is suitable for the development of multiple parallel projects within the enterprise coordinated by project managers.

  • Permission management strategies are different.

    Git does not have strict permission management control. As long as you have an account, you can export, import code, and even perform rollback operations. SVN has strict permission management, and can control permissions for a certain subdirectory by group or individual. Distinguish between read and write permissions. More strictly, rollback operations are not supported. Make sure the code is always traceable.

  • The usage scope of branches is different.

    In Git, you can only branch the entire warehouse, and once deleted, it cannot be restored. In SVN, branch can target any subdirectory, which is essentially a copy operation. Therefore, you can create many hierarchical branches, delete them when they are not needed, and just check out the old SVN version when needed in the future.

  • Based on the third point, Git is suitable for pure software projects, typically some open source projects, such as the Linux kernel, busybox, etc. On the contrary, SVN is good at multi-project management.

    For example, you can store the bsp/design document/file system/application/automated compilation script of a mobile phone project in an SVN warehouse, or store the file systems of five mobile phone projects in an SVN. n (number of projects)*m (number of components) repositories must be established in git. In SVN, only up to n or m are needed.

  • Git uses a 128-bit ID as the version number, and you must indicate which branch it is when checking out; while SVN uses an incrementing serial number as the globally unique version number, which is more concise and easy to understand. . Although you can use gittag to create some literal aliases, after all, that is only for special versions.

  • Traceability

    The typical development process of git is: establish a branch, develop, submit to the local master, and delete the branch. The consequence of this is that previous modification details will be lost.

    Do the same thing under SVN without losing any details.

  • Partial update, partial restoration.

    Since SVN creates a .svn folder in each folder for management, it can easily implement partial updates or restores. If you only want to update certain parts, svn can do it very well. At the same time, if the code is written incorrectly, partial restoration can be easily achieved. Of course, git can also be restored through historical versions, but partial restoration cannot be easily achieved.

Recommended study: "Git Tutorial"

The above is the detailed content of What are git and svn. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What is git commitNext article:What is git commit