Learn Git: Version Control, Git Introduction and Installation

1. What is version control (Version Control)

2. Git Introduction

3. Git installation

3.1  Installation under Linux Git

3.2 install Git under Windows environment

 

1. What is version control (Version Control)

If you use too long a piece of software, or long played a game, then you should have heard the term "release" and even met the software version updates, such as Tencent QQ latest version is 9.1.6 version, League of Legends is the latest version 9.14 version. From the user's perspective, the version of the software is often the newer the better, because the more the new version typically means more features, better interface and fewer BUG. But as a developer of software, things is not necessarily the case.

When people collaborate to develop a long-term, large-scale projects, changes made to the development of the new version brings new BUG is a very common thing, if the new BUG can be located quickly, then just fix it and continue to develop it but if emerging BUG difficult to directly locate it (which is not uncommon, especially in the case of complex project depends on the time)? The best way is to code with the emergence of new BUG, BUG and the code (ie the old version of the code) does not appear to compare to see what local modifications, then one by one investigation of these modified part to determine the cause of the new the reason BUG. And such an approach, we need to retain the old version of our program for future viewing, contrast, and even rollback 1. Such a demand is version control.

The simplest version control is to manually save each version of the project, such as the existence of each directory in each version of the project: Project_v1, Project_v2, Project_V3, then there will be a separate directory under development version: Project_v4_developing. But too many drawbacks of doing so, for example, can not quickly determine the differences in each version, we can not achieve more delicate than the version of history management 2and many more. When the project is growing, more and more after a long history, these drawbacks will be unbearable.

Therefore, we need a more professional version control tools to implement the project, which is a well-known tool for Git.

 

2. Git Introduction

Git is a free, open-source 3Distributed version control system, originally implemented by Linus Torvalds, the purpose is to manage Linux kernel development. Of course, now Git Git compared to the original and has a lot of complexity, with the average user may never be less than all the features of Git.

Git distributed relative to centralized terms, both multiplayer mode of collaboration. The system uses a centralized server and multiple clients collaboration model, the core server, you turn around it, a new modification submitted to the server to form a historical record, the old record is also modified to obtain from the server, and if the server crashes nor to back it up, then the whole system will collapse, because each client is not a complete server data. In a distributed system, the status of participants is identical, their new modifications submitted directly to itself to form a historical record, and share with others, so that others have their own modify records in order to achieve common development, all participants It can be regarded as a server.

In addition, distributed Git, you can also use centralized methods of work, the reason is very simple, since all participants are equivalent to the server, then you can let everyone choose a server machine as a centralized mode, and then modified by sharing it , thus achieving a centralized mode of operation, while at the same time without losing the advantages of distributed: when the selected server crashes, you can re-election of a server from the participants.

Of course, the centralized system is not without advantages, such as a centralized version control system SVN, its support for the rights of the control path, which can more strongly control authority developers.

Because the basic principles and Git workflow even briefly have more content ,

The order Introduction to Git workflow leave to the next Yi articles do.

 

3. Git installation

3.1 Installation under Linux Git

RPM-based Linux distributions, such as CentOS, you can use the following command to install Git:

$ sudo dnf install git-all

In Debian-based Linux distributions, such as Ubuntu, you can use the following command to install Git:

$ sudo apt install git-all

After the installation is complete, you can git --version or which git to confirm if they are successful installation, if the installation is successful, git --version displays the currently installed version of Git, and which git will not output Git is not installed content.

 

3.2 install Git under Windows environment

Under Windows environment to install Git many choices, because there are a lot of built-Git Git-based graphics tools, but this article is recommended to install the standard Git for Windows (with graphical interface), you can obtain the installation package at the following URL:

https://git-scm.com/download/win

Downloaded from the web site is Git for Windows installation package, the download is complete open to install, the installation process can refer to another blog: install Git for Windows

 

Although Git for Windows, but still recommended in a Linux environment to learn Git, there are three reasons:

1. Learn to build Git server, as well as during practice Git remote collaboration, the need for "two machines" simulation, if you do not have two physical machines, then set up a virtual machine is necessary.

2. set up a Linux virtual machine is very simple, not difficult than installing Windows, and there is no risk of piracy: Linux Introduction and Installation

3. Learn Git often learn their commands (and rationale), these commands are Linux commands rather than the windows Cmd command. Of course, I learned to command the operation, with the GUI operation more simple.

 

 

Comment:

1. For example, World of Warcraft, August 19 on the opening of the nostalgic clothes, and nostalgic clothes must be used to achieve a "version rollback" to use the older version of the source code (simply save the old version of the program is not enough, because just nostalgic clothes Games in the past, and so is the rest of the account authentication and current matching, which requires an older version of the source code).

2. The development of a new version, there are often many, many times modified many times we need to see some changes to make a modification, not just to see the changes between the two versions made.

3. the Git source code itself is open, located  https://github.com/git/git

 

Guess you like

Origin www.cnblogs.com/mm93/p/11254189.html