Version control system

As the core product of software research and development, “code” is increasing throughout the development cycle, constantly incorporating new requirements and new patches to solve bugs. This requires a system that can store and track the modification history of files and record the development and maintenance of multiple versions. Thus, Version Control Systems came into being, divided into two main types, centralized and distributed.

Centralized version control system

A centralized version control system is characterized by a single central server that holds all development data, while other client machines keep snapshots of the latest version of the central server files, excluding the change history of project files. Therefore, everyone involved needs to synchronize the latest version from this central server before starting work.





Advantages of a centralized version control system:

1. Simple operation, no difficulty in use, easy to get started.

2. Folder-level permission control with small granularity.

3. It has low requirements on client configuration and does not need to store a full set of code.

Disadvantages of centralized version control systems:

1. The network environment has high requirements, and relevant personnel must be connected to the Internet to work.

2. A single point of failure on a central server affects the whole world. If the server goes down, no one can work.

3. If the central server does not back up data, all data will be lost if the disk is damaged.





Distributed version control system

Distributed version control systems are characterized by the fact that each client is a complete mirror of the code repository, including the change history of the project files. All data is distributed and stored on each client, there is no central server. Some people may ask, our company uses Git distributed storage tool, also has a “central server” ah? In fact, this so-called “central server” is only used to facilitate the management of multi-party collaboration, any client can do its job, it is no essential difference from all clients.





Advantages of a distributed version control system:

1. Localization of version library, complete clone of version library, including labels, branches, version records, etc.

2. Support offline submission, suitable for cross-regional collaborative development.

3. Branch switching is fast and efficient, and creating and destroying branches is cheap.

Disadvantages of distributed version control systems:

1. The cost of learning is high and it is not easy to learn.

2. You can only create branches for the entire warehouse, but cannot create hierarchical branches based on directories.





SVN vs Git

SVN and Git, as representatives of centralized and distributed version control systems, are widely used, and their advantages and disadvantages are often compared. In fact, tools for us, is to help us effectively improve the efficiency and quality of work, the most suitable is the best. We refer to several development scenarios to see the scope of the two version control tools.

Scene 1:

Company A, non-pure technology development, the project contains A large number of media design files, relevant personnel only need to download part of the files they care about; Staff PC configuration is not high, there is no space to copy the whole project data.

Apply to: SVN

Analysis: As long as the company has a large enough server hard disk, employees can only store their own related folders locally, and there is no need to download media files that they do not want to close, so as to avoid wasting the time of file transfer.

Scene 2:

Company B is embedded low-level development, with a large number of project staff distributed in two cities and a huge code; Branch management is used for parallel development of multiple models, and new features and patches are often combined with each other.

Apply to: Git





Analysis:

1.Git has the ability to efficiently manage large scale projects like Linux kernel;

2.Git realizes the features of offline development and code review, and solves the problems of code quality and code coordination in cross-regional collaborative development;

3. Powerful branch management function, easy to query and trace the submission history between branches;

4.Git design based on DAG (directed acyclic graph) provides better merge tracking than SVN linear submission, avoiding unnecessary conflicts and improving work efficiency

Scenario 3:

Company C, software development of an industry, contains sensitive and important data. The code warehouse and version release authority are in the hands of customers, and the code security requirements are high. The developers of the company first submit the code to the local warehouse, and can only submit the code to the release warehouse after the customer’s review.

Apply to: Git

Analysis:

1.Git ensures data integrity through hash encryption to prevent malicious tampering;

2. Code distributed storage, remote DISASTER recovery, to ensure data security;

3.Git team members can build their own local version libraries and branches. Developers can submit code only when the customer sends a merge request, and the customer can review submission instructions and code specifications one by one.

conclusion

It is not hard to see that Git, by virtue of its own advantages, is the perfect solution for most companies to version control tools. In today’s situation where agile development has become the mainstream, r&d cycle is short, and cross-regional collaborative development is abundant, choosing Git is an irresistible trend. Also because of this, there are many at home and abroad based on the cloud Git code hosting service, at present, the author is to use huawei cloud (www.hwclouds.com/devcloud/) configuration management software development services, managed code, later I will detail the use of it.