git installation and use, to be continued...
?
Table of Contents
First, git concept
Second, a brief history of git
Three, git installation
Fourth, git structure
5.Code hostingcenter—interaction between local and remote libraries p>
Six, initialize the local warehouse
Seven, git common commands
1, add and commit commands
2, status command
3, log command
4, reset command
5, hard argument, mixed argument, soft argument
6.Wash off Archives-Retrieve files washed out by native library
7.Retrieve the washed files in the temporary storage area
8, diff command
8.Branches in git
1.What is a branch
2.Operation branch
IX.github account registration
10.Initialize the local library
Eleven, create a remote library
12.Create an alias for the remote library address locally
Thirteen, push operation
Fourteen.Cloning Action
Fifteen, invite to join the team, push operation
16.Pull operation of remote library modification
First, git concept
[1] Git technology: a must for companies, must know
【2】Git concept:
Git is a free, open source distributed version control system that can handle small to large projects quickly and efficiently,
【3】What is version control?
Version control is a system that records changes to one or more files for future revisions to a specific version.【4】Why use version control?
Using a version control system in software development is a wise choice. With it, you can rewind a file to a previous state, or even revert the entire project to a state in the past, even if you mess around The files in the entire project are modified, deleted, deleted, and you can easily restore them to their original state. But the extra work is minimal, you can compare the details of the changes in the files, find out who changed what in the last place, find out what caused the weird problem, who reported a feature bug and when, etc.,
[5] Classification of version control systems:
1.Centralized version control system:
?
Centralized version control systems such as CVS, SVN and Perforce have a single People connect to this server through clients, pull the latest archives or submit updates, this has been standard practice in version control systems for many years, and this practice has brought many benefits, now, everyone can to some extent see what other people in the project are doing, and administrators can easily control the permissions of each developer and manage a centralized version control system; far more than maintaining local repositories on each client Easy and easy,
There are two sides to things, good and bad.The most obvious disadvantage of doing this is the single point of failure of the central server.If the server is down for one hour, then in this hour , no one can submit updates, and can't work collaboratively,
2.Distributed version control system
Due to the shortcomings of the centralized version control system above, the distributed version control system was introduced,
In such systems, such as Git, BitKeeper, etc., the client does not only extract the latest version of the file snapshot, but mirrors the code repository completely,
? span>
Going further, many of these systems can be specified to interact with several different remote code repositories, so that you can work with people from different teams on the same project,
? span>
The distributed version control system does not store the differences between the project version and the version when managing the project.It stores the index (requires very little disk space, so each client can put down the history of the entire project)
? span>
Second, a brief history of git
A brief history of BitKeeper [1]: Baidu Encyclopedia
? span>
Linux--->more and more code--->optimization is getting better and better---->project management tool---->BitKeeper----->one week Develop Git----->Deploy Linux to Git within a month---->Free, Open Source---->Widely used
Three, git installation
【1】Git official website:
Git
Attached Baidu cloud disk download address:
Link: https://pan.baidu.com/s/1Y7oJK7tA3B9FS5rsWBW4oQ
Extraction code: ukpz
【2】Installation
Direct next step
? span>
? span>
?
? span>
? span>
? span>
After the installation is successful, right-click on the desktop and select: Git Bash Here to open the terminal
? span>
Four.git structure
Git structure
?
5.Code hostingcenter—interaction between local and remote libraries
【1】What is the code hostingcenter?
We already have a local library, which can help us with version control, why do we need a code hostingcenter?
It's task is to help us maintain remote libraries,
Let's talk about the interaction between the local library and the remote library, which are also divided into two types:
(1) Collaboration within the team
? span>
(2) Cross-team collaboration
Cross-team collaboration
? span>
【2】Type of hostingcenter:
In the LAN environment: You can build a GitLab server as a code hostingcenter, and GitLab can build it by yourself
In the external network environment: GitHub or Gitee can be used as the code hostingcenter, GitHub or Gitee is a ready-made hostingcenter, you don't need to build it yourself
Six, initialize the local warehouse
The commands in [Git] are the same as in Linux:
【1】Clear screen clear
【2】View directory structure ll
[3] Check the version of Git installed git--version
[Initialize local warehouse]
【1】Open Git Bash Here
【2】Registered Identity (Signature)
Set username:
git config--global user.name "jason_yu"
Set Email:
git config--global user.email "[email protected]"
[3] Use the git init command to initialize the job
[4] A hidden directory of.git is generated in GitReps in the corresponding directory
Note: The.git directory in this local library should not be washed or modified at will, it is easy to cause problems,
Seven, git common commands
1, add and commit commands
Add file: add Submit file: commit
[1]Create a file Demo.txt
?
[2] git add submits the code of the local working area to the temporary storage area
? span>
[3] git commit is submitted from the staging area to the local warehouse
git commit-m "This is my first commit Demo.txt" Demo.txt
? span>
Notes:
Tags
Leave a Reply
0 Comments