This is the 7th day of my participation in the August Text Challenge.More challenges in August


Git is introduced

Git is an open source distributed version control system, which can effectively and quickly handle project version management from very small to very large. There is a concept involved here: version control. So what is version control? Why do you need version control?

For example, let’s say you’ve been working on a resume recently. You’ve been working on it all afternoon, and you’ve finished the rough structure. The next day, it occurs to you that something on your resume doesn’t quite make sense, so you go to your computer and try to change it. Then you realize that you can’t change it directly from the original, or it will be difficult to go back.

The result was several days of revision and more and more versions of the resume:You’re starting to think this isn’t a good idea, but is there a tool that can record every version of my resume, record what I change, and switch to whatever version I want? Of course, Git can do that for you.

Git does more than that. It has the following functions:

  1. Synergy to modify
  2. The data backup
  3. Version management
  4. Access control
  5. The historical record
  6. Branch management


Introduction to other version control tools

About version control tool, can be divided into two categories, category is a delegate with SVN centralized version control tool, the working principle of this kind of tool is that it has a central server, all developers need to download the code from the server to the local, and then in the local development, the development is completed and submitted to the server.

So the biggest disadvantage of a centralized version control tool is that it can’t be detached from the server, and if the server is damaged, all files are lost.

There are also distributed version control tools, such as Git, that provide direct local version control for each developer, meaning that there is a complete local commit history. This type of tool has no central server limitation, greatly reducing the possibility of file loss.


Git history

This is a brief mention, I believe you are familiar with these historical stories.

The creator of Git is Linus Torvalds, and the birth of Git does not leave the Linux system. As we know, the creator of Linux system is Linus Torvalds, who is a legendary figure, and has a classic saying: Talk is cheap, show me the code.

On the original Linux system, Linus was responsible for merging code from people all over the world, but as the system grew larger and more code became available, manual merging became too much work. At this time, BitMover, the owner of BitKeeper, licensed the software to the Linux open source community for free out of humanitarian reasons. However, someone in the Linux community tried to crack the BitKeeper software, causing BitMover to withdraw the free use of the software. Of course, there’s no way to tell who’s right and who’s wrong, and BitMover’s licensing terms are said to be quite unequal to the Linux community.

After all, it happened. Linnaus gave full play to his programming strength and successfully developed the main program of Git with C language within two weeks. A month later, the code of Linux system had been managed by Git.


Git download and installation

In order to take care of the students who do not have the foundation of Linux (in fact, I am not very good at Linux command), the next all operations will be carried out on the Windows system, we first go to the official website to download Git, download the address: git-scm.com/downloads

Download the corresponding version according to your own requirements, and double-click the installation package to start the installation:


Here’s the next step:

Here is the next step:

Still direct next step:

Note that the setup program chooses the second option by default. Let’s explain the three cases separately:

  1. The first method doesn’t change the system variable PATH, which is the safest way to do it, but you can only use Git directives in Git Bash
  2. The second way is to modify the system variable PATH so that you can use Git directives in a Windows CMD window, but this is theoretical security and is not guaranteed
  3. The third way also modifies the system variable PATH and overrides the find and sort commands,

So here we can choose the first or the second method as the case may be, do not choose the third method, I recommend you to choose the first method is enough, after selecting the next click:Here is to select the local library and remote library connection mode, the default is ok, next step:


Here is a conversion to the carriage return newline style between Windows and Unix, the default is ok, next:


Select the terminal to use, the default is ok, next step:


Then click Install and Git will be installed.


At this point, we just need to right mouse anywhere, and the following two options appear:Git Bash Here to open a Git terminal:



Code hosting center

Given that Git allows every developer to iterate over versions locally, what is the role of a code hosting center?

Its role is to maintain remote repositories, typical code hosting centers are: GitHub and code cloud.

In the LAN, we can also set up a hosting center through GitLab.


Interaction between local libraries and remote libraries

The following describes the interactive operations between local and remote libraries, which can be divided into two situations:

  1. Intra-team collaboration
  2. Collaboration across teams


Intra-team collaboration

First, let’s talk about team content cooperation. Suppose there is a programmer Named Zhang SAN and an employee named Li Si under him. How do these two people cooperate in team development?

First, Zhang SAN develops locally and builds up the basic structure of the project. At this time, Zhang SAN pushes the code of the local library to the remote library:At this time, the hosting center has the remote library pushed by Zhang SAN. At this time, Li Si only needs to download the code of the remote library to the local:After the development is complete, push the local library to the remote library.After The remote library has been modified, in order to obtain the modified contents of the remote library, John needs to perform a pull operation on the remote library, and pull the contents of the remote library to the local library:In this way, two people realize collaborative development. Note that Li Cannot directly push the code of the local library to the remote library, because the remote library is created by Zhang SAN. In order to push the code, Li Si must join Zhang SAN’s project team, which will be described in detail later.


Collaboration across teams

Another scenario is that a programmer Named Lao Wang is developing a project and finds himself in a difficult situation. So he goes to his former teacher, Lao Wei, and asks him for help. However, Lao Wei is not a member of the project team.If Lao Wei wants to participate in the project, he needs to make a copy of the remote database pushed by Lao Wang:At this point, the code hosting center has two copies of the same remote library, but one is Lao Wang’s, one is Lao Wei’s, and then Lao Wei will clone the code of his remote library to the local library:When the problem is solved, Wei pushes the code from the local library to his remote library:At this time, Lao Wei needs to initiate a pull request. After the request is initiated, Lao Wang will receive the request and code from Lao Wei, which can be merged into his own remote database after review by Lao Wang:At this time, Lao Wang then pull the remote library operation, you can get the code modified by Lao Wei to the local.


The tail language

✍ Code writes the world and makes life more interesting. ❤ ️

✍ thousands of rivers and mountains always love, ✍ go again. ❤ ️

✍ code word is not easy, but also hope you heroes support. ❤ ️