Git introduction installation and use

Table of Contents
Chapter 1 Version Control 1
1.1 Focus on Learning 1
git: Distributed Version Control System 1
1.2 Version Control Concept 1
1.3 What You Need to Know 1
1.4 Classification of Version Control System 1
1.4.1 Local Version Control 1
1.4.2 Centralized Version Control 1
1.4.3 distributed version control system 1
Chapter 2 Git introduction 2
2.1 official website 2
2.2 git function 2
2.3 Git-based products 2
2.3.1 GitHub 2
2.3.2 gitlab 2
2.3.3 yards cloud 2
2.4 features 2 git
first Chapter 3 Git Installation 3
3.1 Yum Installation 3
3.2 Source Installation 3
3.2.1 Installation Dependencies 3
3.2.2 Compilation and Installation 3
3.2.3 Settings Before First Entry 4

Chapter 1 Version Control
1.1 Focus on Learning
Git: Distributed Version Control System

1.2 The concept
of version control The management of various program codes, configuration files and documentation changes in the software development process is one of the core ideas of software configuration management.

1.3 Need to master
the construction, maintenance and use of the version control system.

1.4 Classification of version control systems
1.4.1 Local version control
Copy the entire project directory to save different versions (for example, add a timestamp to show distinction).
Disadvantages: It is very troublesome to compare the differences of each day.
Only applies to one computer.

1.4.2 Centralized version control is
mainly based on SVN, which accounts for 30% to 40% of the market.
There must be a single centralized management server, and everyone needs to connect to this server to work. Upload new version information every day (to facilitate rollback to a certain version).
Main tools: CVS, SVN, Perforce
Disadvantages: Out of SVN, offline state, SVN server failure can not work.
Not applicable to open source software.
Main disadvantages: mainly work around the SVN server.

1.4.3 Distributed version control system
Main tools: Git, mercwrial, Bazzaar, Darcs... The
client does not know to extract the latest version of the snapshot, but clones the complete image of the code repository. In this way, each machine has complete code information, and server failure does not matter.
Each client (developer's computer) is the same as the server. The server-side data is the oldest.

Chapter 2 Introduction to Git
2.1 Official website
https://git-scm.com
Help manual URL: https://git-scm.com/book/zh/v2

2.2 Git function
can effectively manage very small to very large project versions.

2.3 Git-based products
2.3.1 GitHub
can store code information in a public or private way, a version control platform, web interface (similar to Baidu Netdisk ), which was later acquired by Microsoft.
2.3.2 Gitlab
can build a git server (safe) in its own network.
2.3.3 Code Cloud
Domestic code hosting platform.

2.4 Git features
Clone data version: server to local clone database.
Submit code: This machine submits version information such as code to the server.
Merge branches: merge version branches on this machine.
Pull and merge branches: fetch on the server, and then merge with your own main branch.
Code conflict resolution: resolve the code conflict (go language and other methods), and then submit the patch.

Chapter 3 Git Installation

3.1 yum installation
Disadvantage: the version is too low

[root@git_server ~]# yum -y install git
[root@git_server ~]# rpm -aq git

Insert picture description here

3.2 Source code installation
Disadvantages: slow
Git download address: https://github.com/git/git/releases

3.2.1 Installation dependencies
If there is an old version that needs to be removed before (git --version view, yum remove git remove)

[root@git_server ~]# yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
[root@git_server ~]# yum -y install perl-ExtUtils-MakeMaker

3.2.2 Compile and install

(I changed to the latest version later, no effect)
Insert picture description here

Execution wget without installation package https://github.com/git/git/archive/v2.22.0.tar.gz

[root@git_server tools]# tar xf git-2.22.0.tar.gz -C /usr/src/
[root@git_server tools]# cd /usr/src/git-2.22.0/
[root@git_server git-2.22.0]# make configure

Insert picture description here

[root@git_server git-2.30.1]# make prefix=/usr/local/git all  //编译
[root@git_server git-2.30.1]# make prefix=/usr/local/git install  //安装
[root@git_server git-2.30.1]# ln -sf /usr/local/git/bin/git /usr/bin/  //软链接
[root@git_server git-2.30.1]# git --version   //查看版本

Insert picture description here

3.2.3 Settings before first entry

[root@git_server ~]# git config --global user.name "hannibal"   //使用用户
[root@git_server ~]# git config --global user.email "[email protected]"  //使用邮箱
[root@git_server ~]# git config --global color.ui force    //语法高亮
[root@git_server ~]# git config --list  //列出配置

Insert picture description here

Continuously updating...

Guess you like

Origin blog.csdn.net/qq_39109226/article/details/113778548