Updated on 2023-05-06 GMT+08:00

Overview

Purpose

This document is intended to help developers who are interested in Git to better use Git and apply Git in the CodeArts practice.

Git Overview

Git is a distributed version control system (VCS). VCSs manage all code revisions during software development. They store and track changes to files, and records the development and maintenance of multiple versions. In fact, they can be used to manage any helpful documents apart from code files. VCSs are classified into centralized version control systems (CVCSs) and distributed version control systems (DVCSs).

Centralized Version Control Systems

A CVCS has a central server that contains all development data, and a number of clients that store snapshots of the files in the central server at one point. That means the change history of project files is kept only in the central server, but not on the clients. Therefore, developers must pull the latest version of files from the central server each time before starting their work.

Common CVCSs include CVS, VSS, SVN, and ClearCase.

The advantages and disadvantages of CVCSs are listed below.

Table 1 Advantages and disadvantages of CVCSs

Advantages

Disadvantages

  • Easy to use.
  • Granular permission control on the directory level.
  • Large storage space is not required on the clients because they do not store the entire copy of the code repository.
  • A highly stable network is required since developers must work online.
  • If the server breaks down, the development work is suspended.
  • All data will be lost if the hard disk of the central server is corrupted and no proper backup is kept.

Distributed Version Control Systems

In DVCSs, every client is a complete mirror of the code repository. All data, including the change history of project files, is stored on each client. In other words, there is not a central server in this distributed system. Some companies which use Git may call a computer as the "central server". However, that "central server" is in nature the same as other clients except for the fact that it is used to manage collaboration.

Common DVCSs include Git, Mercurial, Bazaar, and BitKeeper.

The advantages and disadvantages of DVCSs are listed below.

Table 2 Advantages and disadvantages of DVCSs

Advantages

Disadvantages

  • Each client stores a complete copy of the code repository, including tags, branches, and version records.
  • Offline commits enable easy cross-distance collaboration.
  • Branches are cheap to create and destroy, and fast to check out.
  • High learning thresholds.
  • Branches can be created only for the entire repository but not for individual directories.