The vast sea of millions, thank you for this second you see here. I hope my article is helpful to you!

May you keep your love and go to the mountains and seas in the coming days!

This article teaches Git

1. What is Git?

1.1 Development History

Without further ado, Git specific development process here I will not say, look at the picture is finished. In 2005, Linus wrote a distributed version control system in C in just two weeks, and within a month, the source code for Linux was managed by Git. How do you define a cow? You can get a sense of that.

Look at Linus, look at him, look at him from a distance!

1.2 What is Git?

Git is the most advanced Distributed Version Control System (DVCS) in the world.

1.3 the Git and SVN

Let’s talk about the familiar differences between Git and SVN:

  • SVN: The SVN is a centralized control system. The version library is centrally stored on the central server. And every time a developer wants to do something, they use their own computer, so every time they need to get the latest version from a central server before they start doing something. Finish and then push their latest code to the central server. What’s the downside? Once the central server goes down, the whole project goes down. And the biggest problem is that centralized version control systems must be networked to work. If in the local area network also line, the speed is fast enough, but if it is on the Internet, for example, like my slow network speed, may upload a few M files need 5, 6 minutes, this does not divide the minutes hold back a disease.
  • Git: Git is a distributed version control system, in which there is no central server and every developer is a complete version repository. What are the advantages of this, if one person’s system crashes, computer crashes, etc., it can be copied from someone else and used. Of course, the advantage of Git is not only that it does not need to be networked, but also that it has extremely powerful branch management, leaving SVN and others far behind.

2. What does Git do?

Let’s first look at the scenarios that exist for enterprise development:

2.1 Code Merging

In a project, it is impossible for one person to solve all the modules. This is when tasks need to be assigned to others, who will complete their own project modules and then integrate them together.

For example, fish and cat are comraves-in-arms in a project group. Today, the product manager put forward two requirements for fish and cat to finish in one day. That’s it. When they’re done, do they merge?

2.2 Code Backup

Xiaoyu worked overtime in the company today, at one o ‘clock in the morning, finally a project module can be delivered code in sight. But!! Never expected, the company power outage, small fish’s computer shut down, put into how much effort of the code so over!

2.3 Code Restoration

Today, the product manager told Xiaoyu that xiaoyu was asked to get a complex function module, which was extremely unstable relative to the overall project and might need to change many codes in the project. What should Xiaoyu do at this time?

2.4 Problem Tracing

Kitty is a new person in the project team, and she has written many code bugs. And dishonest, every time there is a bug, will say that it is not his problem, is written before the original. So, how do we know who caused the bug?

Don’t worry, Git can solve these problems perfectly.

3. Use of Git (emphasis)

To solve the above problems with Git, you are sure not to download a Git to use, and it is completely free.

3.1 download

This is just about installing Git on Windows.

You can download the installation program directly from the official Git website, and then install it by default.

Once installed, you can right-click on any folder or desktop and see the following menu:

Git Bash Here = Git Bash Here = Git Bash Here

Git is a distributed version control system and requires each machine’s identity, otherwise you won’t be able to tell which one is which.

$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"
Copy the code

Note the –global parameter of the git config command. This parameter means that all git repositories on your machine will use this configuration. You can also specify different user names and Email addresses for each repository.

Here is my configuration:

Now you can look at the global configuration that I set up

$  cat ~/.gitconfig
Copy the code

3.2 Creating a version library

What is a version library? Repository is also called repository. Git can keep track of every change or deletion of a file, so that it can be traced at any time in history or “restored” at some point in the future.

Git init = git init = git init = git init = git init = git init

Git repository: Git repository: Git repository: Git repository: Git repository: Git repository: Git Repository: Git Repository Note: Do not manually modify the files in this directory, otherwise you will break your Git repository and you will not be able to use it. If you don’t see the.git directory, that’s because it’s hidden by default. You can just watch me do it like this

3.3 How do I add a file to the Version Library

Do not know each guest officer has seen Zhao Benshan and Song Dandan’s sketch, there is a bridge section, Song Dandan asked Zhao Benshan: the elephant into the refrigerator need a few steps? Now, what steps does it take to add a file to a local repository?

For now, it takes three steps to put an elephant in the fridge and two steps to put a file in a Git repository. More convenient and fast bar!

First, we need to create a file (hello.txt) and add the words: helloGit!

The next few steps are not screenshots, put the code in, you can copy and paste to the local test! Each step is followed by a comment. Look how sweet I am. You don’t see many guys as sweet as me. O ha ha ~ O (studying studying)

$Vim hello.txt (Create and enter vim editor, edit hello.txt file)
Copy the code
helloGit! In vim editor, type I insert, write helloGit! Use the Esc key in the upper left corner and type :wq to exit the vim editor.Copy the code

First, tell Git to add the file to the repository with the git add command:

$Git add hello.txt to create hello.txt
Copy the code

Execute the above command, nothing is displayed, that’s right, the Unix philosophy is “no news is good news”, indicating success.

Git commit:

$ git commit -m "Add Hello. TXT to local repository"(This is to commit hello. TXT from the cache to the local repository)1 file changed, 1 insertion(+) create mode 100644 Hello.txtCopy the code

Git commit -m: git commit -m: git commit -m: git commit -m: git commit

-m “XXX”? There are ways to do this, but it is strongly discouraged because the input submission instructions are important for yourself and for others to read. If you really don’t want to enter the instructions, please Google, I really don’t want to tell you this parameter, I don’t want to harm you. Remember, this submission note has to be written and meaningful.

Git commit: 1 file changed: 1 file changed (our new hello. TXT file) 1 Insertion (+) : Inserted two lines (Hello. TXT has one line)

So why does Git need to add and commit files? Since you can commit many files at once, you can add different files multiple times, such as:

$ git add file1.txt
$ git add file2.txt file3.txt
$ git commit -m "add 3 files."
Copy the code

3.4 Checking File Status

At this point, we have successfully added and committed a hello. TXT file. Now, it is time to get back to work, so we go ahead and modify the hello. TXT file to the following:

helloGit!
Git is nice software!
Copy the code

Now you can track the current status of the file with git status:

  • Now, let me explain thisgit statusCommand:

The git status command keeps us informed of the current status of the repository. Hello. TXT has been modified but is not ready to commit.

Git tells us that hello. TXT has been changed, but it would be nice to see exactly what has been changed and compare it. Git diff: “hello. TXT” “hello. TXT” “hello.

  • Now, let me explain thisgit diffThis command:

Git diff: git is nice Software git diff: git diff: git is nice Software

Know the hello. TXT made what revised, then submit it to the warehouse is assured, commit changes and submit new files are the same two steps, the first step is to git add:

$ git add hello.txt
Copy the code

Again, no output. Before git commit, run git status to check the current repository status:

$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	modified:   hello.txt
Copy the code

Git status tells us that the changes to be committed include hello.txt.

$ git commit -m "Modify the contents of hello.txt"[master a3c7c44] 1 file changed, 2 insertions(+)Copy the code

After the commit, we can use git status to check the current status of the repository:

$ git status
On branch master
nothing to commit, working tree clean
Copy the code

Git tells us that there are currently no changes to commit, and that the working tree is clean.

Git is too easy to use! Now, Git gets even better. Git provides the “regret medicine “**.

3.5 regret medicine

Now you can modify the add commit file as well. Now, let’s practice again, modify hello. TXT as follows:

helloGit!
Git is very nice software!
Copy the code

Then try adding a submission:

$ git add hello.txt
$ git commit -m "Add very to hello. TXT"1 file changed, 1 insertion(+), 1 deletion(-)Copy the code

Like this, you keep making changes to the file, and then you keep committing changes to the repository. For example, every time the project manager makes a request, you do it and submit the code. But what if, on one of the submissions, a Bug appears, or an important file is accidentally deleted, causing the whole project to wobble and crash? As the saying goes, life is alive, there is always too late to regret things, but life is no regret medicine can eat ah! But just because there is no regret, life is destined to be wonderful, must want to live well this time, will be very meaningful. If anyone has one, please give me one so that I can go back to a time and say to that girl… Ahem, a bit of a digression! Ha ha

In Git, don’t worry, because there will always be a remedy for regret.

When working with files, you can “save a snapshot” whenever you feel the file has changed enough. This snapshot is called a commit in Git. Once you make a mess or delete a file by mistake, you can recover from your most recent commit and continue working, rather than losing months of work. Don’t you think it’s awesome? Hey hey, specific how to operate, please see as follows:

  • First, let’s review what we did with hello.txt and how many versions were committed to the repository:

    • Add hello.txt to the local repository
    helloGit!
    Copy the code
    • Modify the hello. TXT content
    helloGit!
    Git is nice software!
    Copy the code
    • Add nice to hello. TXT
    helloGit!
    Copy the code
  • In practice, it is impossible to remember what was changed in a file every time, but it is useless to add the file to the committed Git repository. Git can help me keep track of the status of the file, and there must be some command that tells us the history of the file. Git log Git log Git log

  • Next, let me explain git log:

    The git log command displays the latest commit logs from the most recent to the most recent commit. We can see 3 commits, the latest is to add nice to hello. TXT, the last is to modify hello.

    Pretty =oneline: pretty=oneline:

    The thing to notice here is that you see a bunch of things like 7FBDD8F… Git commit id = 1,2,3… Instead, it’s a very large number calculated by SHA1, expressed in hexadecimal, and the COMMIT ID you see is definitely different from mine, whichever is yours (note). Why is the COMMIT ID represented by such a large string of numbers? Because Git is a distributed version control system, Git uses this unique id to distinguish each commit. As a version number, that’s definitely a conflict.

    Every time you commit a new version, Git actually strings them together into an automatic timeline. If you use a visualization tool to view Git history, you can see the timeline of Git commit history more clearly:

  • Git: Hello. TXT: hello. TXT: Git: hello.

    • How does Git determine the current version of Git?

      In Git, HEAD represents the current version, that is, the latest commit. (Note that my submission ID is not the same as yours), the previous version is HEAD^, and the previous version is HEAD^^, of course, it is easier to write 100 ^ in the previous 100 versions, so write HEAD~7fb.

    • Git reset: “hello. TXT” “hello. TXT” “hello.

      $Git reset - hard head ^ (or written git reset - hard 7 fbdd8f587f6510248a23ab3a8217c1457237b31)HEAD is now at a3c7c44 modify hello.txtCopy the code
    • Let me explain the git reset command:

      What happens inside Git when it executes this code?

      When you go back, Git simply adds nice from HEAD to hello. TXT:

      ┌ ─ ─ ─ ─ ┐ │ HEAD │ └ ─ ─ ─ ─ ┘ │ └ ─ ─ > a. hello. TXT add nice │.through modify hello. TXT contents │.through add hello. TXT to local repositoryCopy the code

      To modify the hello.txt content:

      ┌ ─ ─ ─ ─ ┐ │ HEAD │ └ ─ ─ ─ ─ ┘ │ │.through the hello. TXT add nice │ │ └ ─ ─, a. modify > hello. TXT contents │.through add hello. TXT to local repositoryCopy the code

      I also updated the files in the workspace. So whatever version number you want HEAD to point to, that’s where you place the current version.

      So this is how you roll back or restore. Hey, hey, you know what?

      There is a parameter called hard. What does that do?

      This place can have three parameters, what are they?

      • Soft: Leave working tree and index untouched Soft reset: does not change the workspace and index
      • Mixed: Leave working tree untouchd,reset index Mixed: Leave workspace unchanged,reset index file
      • Hard: Reset working tree and index(discard all local changes) Hard: Reset working tree and index(discard all local changes)
    • See if the contents of our hello.txt file really change to the contents of the previous version:

      $ cat hello.txt
      helloGit!
      
      Git is nice software!
      Copy the code

      It was restored.

      Git hello. TXT: git hello. TXT: git hello. TXT: git hello.

      $ git logCommit a3c7c4438d964f09fdf1914cb940816b1a3345c8 (HEAD - > master) Author:... Date:... Modify the hello. TXT content commit 32 b0ee32bfb99ea931bbf19b4a700d464d20bc68 Author:... Date:... Add hello.txt to the local repositoryCopy the code

      The latest version of hello. TXT with nice is no longer visible! This is like you, you take the medicine of regret, from the 21st century to the 20th century on a time shuttle, the latest version, certainly not see!

  • But but what if I want to go back to the 21st century? There’s no going back, is there?

    In Git, you can find a commit id of 7fbdd8f that adds nice to hello. , so you can specify a future version:

    $ git reset --hard 7fbdd8fAdd nice to HEAD is now at 7fbdd8f hello. TXTCopy the code

    It is not necessary to write the full version number, just the first few digits will do, Git will automatically find it. Of course, you can’t just write the first one or two, because Git may find multiple version numbers and never know which one it is.

    Let’s now carefully see if the contents of hello. TXT are changed back:

    $ cat hello.txt
    helloGit!
    
    Git is very nice software!
    Copy the code

    Hey hey, did not expect, others after 18 years to be a hero, but I immediately came back. Imagining

    • But what if my command line window closes, or I regret it the next day and want to restore to the latest version? We cannot find the latest version of the commit ID. Guess what.

      All right, all right. I’ll tell you what. Remember I just said that in Git, there is always a remedy for regret. Git felog is used to record every command you make:

      $ git reflog7fbdd8f (HEAD -> master) HEAD@{0}: reset: moving to 7fbdd8f a3c7c44 HEAD@{1}: reset: TXT add nice a3c7c44 head @{3}: commit: 32b0ee3 HEAD@{4}: commit (initial): Add hello. TXT to the local repositoryCopy the code

      It’s a relief to be here, and now you can go back to the future in a time machine. Now find your latest version of the commit ID and execute the following code:

      $ git reset --hard 7fbdd8fAdd nice to HEAD is now at 7fbdd8f hello. TXTCopy the code

      Let’s see if the contents of hello. TXT are changed back:

      $ cat hello.txt
      helloGit!
      Git is very nice software!
      Copy the code

      Heh heh, just ؏؏☝ᖗ乛 plus-one 乛ᖘ☝؏؏ perfect!! Yeah, I feel it. It’s all back.

    • After learning this, don’t you feel that it is really nice to have Git, but also to have regret medicine to eat, travel through time and space at will!

      Let’s keep this in mind:

      • HEADThe version you point to is the current version, so Git allows you to run commands through the history of versionsgit reset --hard commit id.
      • Before the shuttle, usegit logYou can view the commit history to determine which version you want to fall back to.
      • To go back to the future, usegit reflogReview the command history to determine which version to go back to in the future.

3.6 In-depth analysis of Git’s work

After a series of learning, we know that when using git add, git commit command, he added the file to the local repository directly, or pushed to the remote repository? Let’s take a closer look at Git.

  • First, let’s take a look at Git’s two repositories and four work areas:

    Git is divided into two types of repositories, local and remote.

    • Local repository: A Git repository that resides on the developer’s own computer
    • Remote repository: Is a Git repository on a remote server

    Git’s four working areas can be clearly seen in this chart:

    • WorkspaceThe files and directories you see on your computer, under Git version control, make up your workspace, like minetestA folder is a workspace.
    • Index/StageGit /index is a temporary repository for your uncommitted changes. In fact, you executegit addThe file changes are added to this area. 支那
    • Repository: local warehouse, you executegit cloneAddress is a clone of a remote repository to a local repository. It is a repository of versions that are stored locallyHEAD points to the latest release in the repository. And when you performgit commitFile changes will be made to the local repository
    • Remote: Remote warehouse, is similar to github, code cloud and other sites provided by the warehouse, can be understood as the Remote data exchange warehouse ~
  • Next, let’s take a look at how Git works:

    In fact, Git workflow, in our previous operation process, basically involved. Here I have a complete overview of it!

    • Pull file code back from remote repository (git clone)
    • In the working directory, add, delete, change and check files;
    • Place the changed files in the temporary storage area; (git add)
    • Submit the files in the staging area to the local warehouse; (git commit)
    • Push files from the local repository to the remote repository (git push)

    We have completed the full Git forward workflow, and we can’t help but give you a thumbs up

  • At the workflow stage, Git files can be in one of four states:

    • Untracked: The file has not been added to the Git repository and has not participated in version control, i.e. its status has not been tracked. At this time the file passesgit addState, which can become Staged
    • UnmodifiedThe file has been added to the Git repository, but has not been modified yet. A file that is Unmodified becomes Modified. If you are usinggit removeMove the library, then becomes an Untracked file.
    • Modified: A file must have been Modified. This state can be entered into staged states by using the stage command
    • staged: Temporary status executiongit commitThe changes are synchronized to the library, and the files in the library and the local files become the same again, with the file in the Unmodified state.

    Is it something we’ve all seen and felt particularly familiar with?

In this stage, you will understand the workflow of Git, and you will know what is going on in many Git operations tomorrow. Not in the process of using the muddled.

3.7 Undoing the Modified File

Of course, you can’t make mistakes in the process! But now that you’ve been working late at 2:30 a.m., you might feel that you can do something unknown in the dead of night, so you add a line to hello.txt:

$ cat hello.txt
helloGit!
Git is very nice software!
My stupid boss.
Copy the code

On your 9th cup of coffee before you commit this code, you suddenly realize stupid Boss is going to cost you this month’s bonus!

Since the error was discovered in time, it can easily be corrected. You can delete the last line and manually restore the file to the previous version. Git status:

$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   hello.txt

no changes added to commit (use "git add" and/or "git commit -a")
Copy the code

Git checkout — file, you can quickly execute this code:

$  git checkout -- hello.txt
Copy the code

Git checkout — hello. TXT git checkout — hello. TXT git checkout — hello. TXT

Hello.txt has not been put into the staging area since the modification. Now, undoing the modification will return to the same state as the repository.

Hello. TXT has been added to the staging area and has been modified. Now, undoing the modification will return to the status after it was added to the staging area.

Putting the file back where it was when you last made a Git commit or git add is a great way to undo the changes you made in error. Now, let’s take a closer look at the contents of the hello.txt file:

$ cat hello.txt
helloGit!
Git is very nice software!
Copy the code

The contents of the file were restored.

Git checkout — file git checkout — file git checkout — file git checkout — file

It’s 3:30 in the morning and you’ve not only written some gibberish, but also git added to the staging area:

$ cat hello.txt
helloGit!
Git is very nice software!
My stupid boss.

$ git add hello.txt
Copy the code

Fortunately, you caught this before git commit. Git staus: The changes have only been added to the staging area and have not yet been committed:

$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   hello.txt
Copy the code

Git reset HEAD

unstage the changes in the staging area and put them back into the workspace:

$ git reset HEAD hello.txt
Unstaged changes after reset:
M       hello.txt
Copy the code

The git reset command can roll back both the version and the changes made in the staging area to the workspace. When we use HEAD, we mean the latest version.

Git status: now the staging area is clean and the workspace has changed:

$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   hello.txt
Copy the code

Remember how to discard workspace changes?

$ git checkout -- hello.txt

$ git status
On branch master
nothing to commit, working tree clean
Copy the code

Ah! You’ll find out, go to f * * king work, don’t do it. And then I continued to code and work overtime. Hey hey, it is impossible not to work, I am a worker!

But now, what if you not only change the wrong thing, but also commit from the staging area to the repository? Remember the version Rollback section? You can go back to the previous version. This is conditional, however, on the fact that you haven’t pushed your local repository to remote locations. Remember that Git is a distributed version control system? We’ll talk about remote repositories later, but once you push stupid Boss commit to remote repositories, you’re in real trouble… Wait until your boss pulls you into the dark room tomorrow

4. Remote warehouse

So far, we have mastered how to operate files in the local repository, and we no longer have to worry about losing backup files. This is only a backup of your computer, but if your computer system crashes and needs to be reinstalled, how to do? Your files are not the same or lost. Or say, same project group, want to undertake many people cooperate development, how should do.

Git can help you solve these problems!

4.1 Introduction to the Remote Warehouse

Git has two repositories, a local repository and a remote repository. Local storage, we get it, but what is remote storage? Don’t worry, let me tell you slowly:

Git is a distributed version control system. The same Git repository can be distributed on different machines. How do you distribute it? In the beginning, only one machine must have an original library. Thereafter, other machines can “clone” the original library, and each machine’s library is the same, there is no primary or secondary.

At this point you’d think you’d need at least two machines to play remote libraries, right? But I only have a computer, you are not embarrassed me fat tiger?

In fact, it is also possible to clone multiple version libraries on a single computer, as long as they are not in the same directory. In real life, however, is no one so silly on a computer with a few remote library play (if you’re really so cute, when I didn’t say), on a computer it doesn’t make any sense to make a few remote library, and the hard drive or computer crashed all libraries will lead to hang up, so I don’t tell you how to clone multiple warehouse on a computer. No need, right?!

What happens is that you get a computer to act as a server, turn it on 24 hours a day, and everyone else clones a copy from this “server” repository onto their own computer, and pushes their own submissions to the server repository, and pulls others’ submissions from the server repository.

It is perfectly possible to set up a server running Git by myself. However, at present, I want to learn Git and set up a server for my own service. Do you tell me the reality? Hey, hey, come on, there must be another way.

Fortunately, there is a magical site called GitHub. As the name suggests, this website is to provide a Git repository hosting service, so as long as you register a GitHub account, you can get a Free Git repository.

But this is a foreign website after all, the speed may not be particularly smooth. In China, we even many companies use another website: code cloud, website: gitee.com. Next, I will focus on how to use the code cloud, registration, connection to the local warehouse and other issues.

4.2 Use of code cloud

4.2.1 Official website address:

Website: gitee.com

4.2.2 Registering an Account

Can’t sign up? Don’t panic! In order to serve the people, here I will also tell you how to operate in detail:

Hey hey, mother no longer worry that I will not register code cloud account!

4.2.3 Creating a Remote Repository

Once you have registered your account, the next step is to create the repository.

At this point, your remote repository is declared complete. Did you suddenly have a remote warehouse, very happy. But how do you add a remote repository?

4.2.4 Adding a Remote Repository

Without further ado, let’s look at two ways to add a remote repository:

Our local computer and remote server can use two ways to transfer data :HTTPS and SSH.

The HTTPS protocol requires you to enter the account password when pushing the code. You only need to configure the SSH protocol once. You do not need to enter the account password. So, we learn to SSH (lazy is a great word for human development).

  • What is the SSH protocol

    SSH is short for Secure Shell and formulated by the Network Working Group of the IETF. SSH is a reliable protocol that provides security for remote login sessions and other network services. The SSH protocol can effectively prevent information leakage during remote management.

When SSH is used for communication, key-based authentication is recommended. So you have to create a pair of keys for yourself, and you need to put the public key on the remote repository.

  • Create a SSH key

    First of all, we can under the user home directory, see if there are any. SSH directory, if you have, to see if this directory is id_rsa and id_rsa pub these two files, if have, can be directly jump to the next step. If not, right-click Git Bash in the folder to go to CMD, create an SSH Key, and enter the command

    $ ssh-keygen -t rsa
    Copy the code

    Enter all the way down press Enter three times without typing anything!

    ! [Git create SSH key.jpg](C:\Users\43835\Desktop\ article \Git \Git create SSH key.jpg)

    If all goes well, you can find the id_rsa and id_rsa.pub files in C:\Users\ username \.

    Note: ID_RSA is a private key and cannot be divulged, id_Rsa. pub is a public key and can be safely told to anyone.

  • Code cloud SSH key configuration

    • Step 1: Then copy the contents of the public key file [id_rsa.pub] generated by C:\Users\Administrator\.

    • Step 2: Open gitee’s official website — [Login] — [Settings] – [SSH public Key] options as shown below:

      Note that after clicking OK, you will need to perform an account security verification by entering your password for the code cloud login.

    • When you’re done, this screen should appear:

      So, why do we need to add this SSH Key, or why does the code cloud need this SSH Key? Because the code cloud needs to know that the submission you are pushing is really your own, and not someone else’s, and Git supports SSH, the code cloud can confirm that only you can push as long as it knows your public key.

      Of course, the code cloud allows you to add multiple keys. Suppose you have a number of computers, and you submit them at work or at home. As long as you add the Key of each computer to the code cloud, you can push them to the code cloud from each computer.

    • After adding the public key successfully, we started adding our remote repository

      After completing the previous operations, make sure that your code cloud has an account, you have your own COMPUTER SSH Key, and you have a remote repository.

      • Find TestGit, the remote repository we created earlier.

        Now we can associate an existing local repository with it and push the content from the local repository to the GitHub repository.

      • Now let’s copy the SSH protocol address above as prompted by the code cloud and run the command from the local repository:

        $ git remote add origin [email protected]:prince-nezha/test-git.git
        Copy the code

        If you do not use the SSH protocol address of [email protected]:prince-nezha/test-git.git, you will not be able to use the SSH protocol address of your remote library. Because your SSH Key is not in my account list, and it does not push your own remote repository.

        The name of the remote repository will be Origin, which is Git’s default name and can be changed to something else, but origin is clearly the name of the remote repository.

      • Now we have associated the remote repository, but the remote repository has no content, now we need to push all the content of the local repository to the remote repository:

        $ git push -u origin masterCounting objects: 9, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (9/9), 771 bytes | 385.00 KiB/s, done. Total 9 (delta 0), reused zero (0) delta remote: Git * [new branch] master -> master branch 'master' set up to track remote branch 'master' from 'origin'.Copy the code

        Git push git push git push git push git push git push

        Git will not only push the contents of the local master branch to the new remote master branch, but also associate the local master branch with the remote master branch, which can simplify the command in the future push or pull.

      • After the push is successful, you can immediately see the content of the remote warehouse is exactly the same as that of the local in the code cloud page:

      • From now on, whenever a change is committed locally, you can run the following command:

        $ git push origin master
        Copy the code

        Push the latest changes from your local master branch to the code cloud, and you now have a truly distributed version library! Are you excited?

      • Here’s one thing to watch out for: SSH warnings

        The first time you use Git’s Clone or push command to connect to a remote repository, you get a warning:

        The authenticity of host 'gitee.com (xx.xx.xx.xx)' can't be established.
        RSA key fingerprint is xx.xx.xx.xx.xx.
        Are you sure you want to continue connecting (yes/no)?
        Copy the code

        This is because Git uses SSH connection, and when SSH connection authenticates the Key of the code cloud server for the first time, you need to confirm whether the fingerprint information of the Key of the code cloud really comes from the server of the code cloud. Enter yes and press Enter.

        Git will print a warning telling you that a Key from the code cloud has been added to a local trust list:

        Warning: Permanently added 'gitee.com' (RSA) to the list of known hosts.
        Copy the code

        This warning will only occur once, and subsequent operations will not have any warning.

  • Here’s a summary of adding a remote repository:

    • To associate a remote library, use the commandGit remote add Origin SSH protocol;
    • After the association, run the commandgit push -u origin masterPush all contents of the master branch for the first time
    • After that, commands can be used whenever necessary after each local commitgit push origin masterPush the latest modification; And one of the biggest advantages of the distributed version of the system is that the local work does not need to consider the existence of remote library, that is, whether or not the Internet can work normally, and SVN in the absence of Internet is refused to work! When the network is available, it is convenient to push the local submission to complete the synchronization.

4.2.5 Cloning a Remote Repository

Remote warehouse done, at this time, the company to a new employee fish, need to get the remote server in the code to the local development, cloning remote warehouse is from the remote warehouse copy to the local, cloning will create a new local warehouse. Select an arbitrary directory where the repository is deployed, and clone the remote repository.

What does the fish need to do now? Come on, follow my operation to go over, ensure your success!

  • Create a new folder, xiaoyu, where the code will be cloned in the future

  • To clone to local, obtain the SSH address of the remote repository:

  • Go to the CMD window and use Git clone command to clone a local library:

    $ git clone [email protected]:prince-nezha/test-git.gitCloning into 'test-git'... remote: Enumerating objects: 12, done. remote: Counting objects: 100% (12/12), done. remote: Compressing objects: 100% (4/4), done. remote: Total 12 (delta 0), reused 0 (delta 0), pack-reused 0 Receiving objects: 100% (12/12) and 1.02 KiB | 346.00 KiB/s, done.Copy the code

    “Hello. TXT” : “hello. TXT” : “hello.

    $ cd test-git
    $ ls
    hello.txt
    Copy the code

    Now xiaoyu has successfully cloned the remote warehouse code, you can operate locally. If more than one person is collaborating on the project, then each person can clone a copy remotely.

  • Note: You may also notice that the code cloud gives you more than one address. You can also use an address like https://gitee.com/prince-nezha/test-git.git. Actually, Git supports several protocols. The default Git :// uses SSH, but other protocols such as HTTPS can also be used.

    In addition to being slow, the biggest problem with USING HTTPS is that you have to enter a password every time you push, but some companies that only open HTTP ports can’t use SSH and can only use HTTPS.

  • SSH protocol is still recommended here, there is no way, with open and simple point, in line with the characteristics of my lazy people. Hey hey!

5. Branch Management (key)

Let’s look at the use of branches in real development

  • Let’s say you want to develop a new feature, but it takes two weeks to complete. In the first week, you write 50% of the code. If you submit it immediately, the incomplete code base will cause others to be unable to work because the code is not finished. If you wait until all the code is written and then commit again, you run the risk of losing progress on a daily basis.

    Now that we have branches, we don’t have to be afraid. You create a branch of your own, which no one else can see, and continue to work on the original branch, while you work on your own branch, commit as you like, until the development is finished, and then merge into the original branch once, so that it is safe and does not affect the work of others.

  • Or leadership let you develop a new function, but not sure this feature you also do it, or the function instability problems, such code if directly submit will inevitably make the whole project is not stable, there are risks, this time we can use the branch function, new features will be submitted to the new branch, to be stable after the merger.

    Does branching sound good? Let’s take a closer look at the branch.

5.1 Creating and Merging Branches

As you probably know from previous studies, Git strings each commit into a timeline, which is a branch. So far, there is only one timeline. In Git, this branch is called the master branch. HEAD doesn’t technically point to the commit, it points to the master, and the master points to the commit, so HEAD points to the current branch.

Git uses “master” to point to the latest commit, and “HEAD” to point to “master” to determine the current branch and its commit point:

So every time we commit, every time we commit, the master branch is going to move a step forward, so as you commit, the master branch is going to get longer and longer.

Git creates a new branch, such as dev, and creates a new pointer called dev to point to the same commit as master.

You see, Git is quick to create a branch, because apart from adding a dev pointer and changing the HEAD point, nothing changes to the workspace files.

However, from now on, changes and commits to the workspace are for the dev branch. For example, after a new commit, the dev pointer moves forward, while the master pointer stays the same:

Once we’ve done our work on dev, we can merge dev to Master. How does Git merge? The simplest way to do this is to point master directly to dev’s current commit:

So Git merges branches quickly too! Change the pointer, workspace content does not change!

After merging branches, we can even delete the dev branch. Deleting the dev branch deletes the dev pointer, leaving a single branch for master:

This is amazing. Can you see the branch combination of Git and how some commits are done through branches?

  • Is it a little bit confusing, let’s do a little bit of actual practice, you’ll see what’s going on.

    • First, we create the dev branch, and then switch to the dev branch:

      $ git checkout -b dev
      Switched to a new branch 'dev'
      Copy the code

      Git checkout the git checkout command with the -b parameter creates and switches.

      $ git branch dev
      $ git checkout dev
      Switched to branch 'dev'
      Copy the code
    • Second, we can use git branch to view the current branch:

      $ git branch
      * dev
        master
      Copy the code

      The git branch command lists all branches, with the current branch preceded by an asterisk.

    • In the third step, we can commit normally on the dev branch, such as making a change to hello.txt and adding a line:

      testDev!
      Copy the code
    • Step 4, we commit our changes on dev:

      $ git add hello.txt 
      $ git commit -m "Test dev branch commit"[dev ebc4496] Dev branch 1 File changed, 1 Insertion (+)Copy the code
    • Step 5: At this point, the dev branch is done and we can switch back to the master branch:

      $ git checkout master
      Switched to branch 'master'
      Copy the code
    • Step 6, we switch backmasterAfter you branch, look at one morehello.txtFile, the content that just added is missing! Because that submission was made indevOn the branch, andmasterThe branch’s commit point remains the same:

      $ cat hello.txt
      helloGit!
      Git is very nice software!
      Copy the code
    • In step 7, we merge the work of the dev branch into the master branch:

      $ git merge devUpdating 21c9de4.. ebc4496 Fast-forward hello.txt | 1 + 1 file changed, 1 insertion(+)Copy the code

      The git merge command is used to merge a specified branch into the current branch. After the merge, look at the contents of hello.txt and you can see that it is exactly the same as the dev branch’s latest commit.

      $ cat hello.txt
      helloGit!
      Git is very nice software!
      testDev!
      Copy the code

      Git is going to Fast forward this merge by pointing the master directly to dev’s current commit, so it’s going to be very Fast. Of course, not every merge can be fast-forward, and we’ll talk about other ways of merging later.

    • Step 8, once the merge is complete, you can safely delete the dev branch:

      $ git branch -d dev
      Deleted branch dev (was ebc4496).
      Copy the code
    • Step 9, after deleting, look at branch, and there is only the master branch left:

      $ git branch
      * master
      Copy the code

      Because creating, merging, and deleting branches is so fast, Git allows you to use branches to complete tasks, merge, and then delete branches. This is just as effective as working directly on the Master branch, but it’s much safer. This is also very suitable for many people to do different functional modules, and then submitted to the server for merging.

  • Learn here, is not to branch creation and merger have a general understanding of ah! Git also encourages us to use branches:

    Check out the branch: Git Branch

    Git branch

    Git checkout

    Git checkout -b

    Git merge

    Git branch -d

5.2 Conflict Resolution

The moon waxes and wanes, things in life are not always perfect, and merging branches is not always smooth.

Let’s take a look at what happens when we merge branches:

Get ready for the new Dev1 branch and continue our new branch development:

$ git checkout -b dev1
Switched to a new branch 'dev1'
Copy the code

Change the last line of hello. TXT to:

creating a new branch.
Copy the code

Commit on the Dev1 branch:

$ git add hello.txt
$ git commit -m "Test merge conflict issues"[dev1 927155c] 1 File Changed, 1 insertion(+), 2 deletions(-)Copy the code

Switch to the Master branch:

$ git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
Copy the code

Git will also automatically prompt you that the current master branch is committed 1 commit ahead of the remote master branch.

On the master branch change the last line of the hello. TXT file to:

creating a old branch master.
Copy the code

Commit:

$ git add hello.txt 
$ git commit -m "Change hello. TXT in master"1 file changed, 1 insertion(+), 1 deletion(-)Copy the code

Now, the master branch and the Dev1 branch each have new commits that look like this:

In this case, Git can’t do a “quick merge”. Instead, it tries to merge the changes together.

$ git merge dev1
Auto-merging hello.txt
CONFLICT (content): Merge conflict in hello.txt
Automatic merge failed; fix conflicts and then commit the result.
Copy the code

Git merge dev1 git merge dev1 git merge dev1

Branch from master to master | MERGING, it also tells us the conflict with the file.

Sure enough there was a clash! Git tells us that the hello. TXT file has a conflict and must be resolved manually before committing. Git status can also tell us about conflicting files:

$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)

You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Unmerged paths:
  (use "git add <file>..." to mark resolution)

        both modified:   hello.txt

no changes added to commit (use "git add" and/or "git commit -a")
Copy the code

We can directly look at the contents of hello.txt:

helloGit!
Git is very nice software!
<<<<<<< HEAD
creating a old branch master.
=======
creating a new branch.
>>>>>>> dev1
Copy the code

Git with < < < < < < <, = = = = = = = > > > > > > > tag out the content of the different branches, we delete the content of the marked line, and preserved after the modification of the following:

helloGit!
Git is very nice software!
creating a new branch.
Copy the code

To submit:

$ git add hello.txt 
$ git commit -m "Modify conflict problem"[master f8e3e2a] Modify conflict problemCopy the code

A branch of information before we can see that the master | MERGING and turned back to the master

In summary, every time Git fails to merge branches automatically, a conflict must be resolved first. After the conflict is resolved, the merge is completed. Resolving the conflict is to manually edit the files that Git failed to merge into the desired content and then commit.

5.3 the Bug branch

In real project development, bugs are a daily occurrence. But bugs need to be fixed, otherwise a project will have instability or greetings from all sides.

In Git, because branches are so powerful, each Bug can be fixed with a new temporary branch, which is merged and then removed. When you receive an issue where the test girl has a bug code 66. You didn’t want to change it, or you wanted to wait until you had time to fix the Bug later, but the test girl kept pushing you.

In the end, you have to fix the Bug, and naturally you want to create a branch of Issue-66 to fix the Bug. Wait, want to create a branch to fix a Bug, but work currently in progress on Dev has not yet been committed:

$ git status
On branch dev
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   git.txt

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   hello.txt
Copy the code

Of course, it’s not that you don’t want to submit, it’s that you’re halfway through your work and can’t submit. But it is expected to take two or three days to finish. But what if the test only gives you two hours to fix the Bug?

Fortunately, Git also provides a Git Stash feature that allows us to “stash” our current work site for later recovery:

$ git stashSaved Working Directory and Index state WIP on dev: f8e3e2a Modified conflictCopy the code

Your workspace is now clean (unless you have files managed by Git) with Git status, so you can safely create branches to fix bugs.

  • Pay attention to: If you use itgit stashWhen the workspace is not in effect, as it was the first time you viewed the workspace, you need to see if there is any new file code that has not been added to the workspace first. Git files that are not in Git version control cannot be usedgit stashSaved. So you should add the file to the workspace first, as to add to the workspace, how to undo the workspace, the previous also explained!

First, determine which branch you want to fix the Bug on, depending on the latest committed branch of the Bug you have encountered. If you cannot find it, assume that you need to fix the Bug on the master branch and create a temporary branch from the master:

$ git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 4 commits.
  (use "git push" to publish your local commits)

$ git checkout -b issue-66
Switched to a new branch 'issue-66'
Copy the code

Now to fix the Bug, we need to find the location of the Bug and modify it. Now all you need is “Git is very nice software!” Git is very good software! And then submit:

$git add hello.txt
$ git commit -m "fix bug 66"
[issue-66 ee213a8] fix bug 66
 1 file changed, 1 insertion(+), 1 deletion(-)
Copy the code

When the fix is complete, switch to the Master branch, complete the merge, and finally remove the issue-66 branch:

$ git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 4 commits.
  (use "git push" to publish your local commits)

$ git merge issue-66Updating f8e3e2a.. ee213a8 Fast-forward hello.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Copy the code

The original workspace has not been moved, and the branch after fixing the Bug does not want, you can also delete it. The delete branch command was introduced earlier. And what was supposed to be a two-hour bug fix only took 5 minutes! What should I do now?

Hey hey, online sneaking fish? Fishing is out of the question in this life. Fishing may be fun for a while, but eventually fishing will have to pay a price. How can you waste it when you’re getting paid to improve yourself? One can derive pleasure from work, and that is a great benefit. There’s only one thing on my mind right now, and that’s coding.

Now, it’s time to get back to work on the Dev branch!

$ git checkout dev
Switched to branch 'dev'

$ git status
On branch dev
nothing to commit, working tree clean
Copy the code

But but, uh, the workspace is clean. Where’s the work scene? It’s not gone, is it? How do we get it back? Don’t worry, your husband won’t hurt you. Hey, hey, rattail juice.

Now let’s see with git Stash list:

$ git stash listStash @{0}: WIP on dev: f8e3e2a modify conflict problemCopy the code

The workspace is still there, it’s just that Git has stash content somewhere, but it needs to be restored. There are two ways to do this:

One is to restore with a Git Stash apply, but the stash content is not deleted. You need to remove it with a Git Stash pop.

Another way to do this is to use git Stash pop, which removes the stash content as well:

$ git stash pop
On branch dev
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   git.txt

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   hello.txt

Dropped refs/stash@{0} (16d1c361031a39e7a97b8e63c3a6dcdef58ac37e)
Copy the code

If you look at the Git Stash list, you won’t see any stash content:

$ git stash list
Copy the code

You can do this multiple times with the git Stash list and then restore the specified stash with the following command:

$ git stash apply stash@{0}
Copy the code

When fixing bugs, they create new Bug branches to fix them, merge them, and then delete them.

When the work in hand is not finished, first put a git stash on the work site, then go to fix the Bug, and then go back to the work site with a Git stash pop.

6. Label management

Git has a commit.

“Please pack and publish last Monday’s version, commit number 6A5819E…”

“A jumble of numbers is hard to find!”

If there is another way:

“Please pack and release last Monday’s version as V1.2.”

“Ok, follow tag V1.2 to find commit!”

So, a tag is a meaningful name that’s easy to remember, tied to a commit.

The reality is that when a release is made after a project has been completed and branches have been merged, it is common to put a tag in the release library so that only the release at the time of the tag is identified. Whenever you take the version of a label in the future, you take the historical version of that label moment. So, the label is also a snapshot of the repository.

This also allows you to find out which version has a problem, quickly locate it under which branch, or use this tag to fix the Bug. Git’s tag is a snapshot of the repository, but it’s actually a pointer to a commit. But branches can be moved, labels cannot), so creating and deleting labels is instantaneous.

6.1 Creating labels

Now that you know how to tag Git, how do you tag Git?

  • First, switch to the branch that needs to be tagged:

    $ git branch
    * dev
      master
    $ git checkout master
    Switched to branch 'master'
    Copy the code

    Git tag

    to create a new tag:

    $Git tag v1.0
    Copy the code

    You can view all tags with the git tag command:

    $ git tag
    v1.0
    Copy the code

    In general, the default label is placed on the latest commit that has just been released. But but if you forget to label it. For example, it is Already Friday, but the label was not hit when the version was sent last Friday, how to do?

    The method is to find the commit ID of the historical commit and type it:

    $ git log --pretty=oneline --abbrev-commitee213a8 (HEAD -> master, tag: V1.0, 927155c (dev1) test merge collision ebc4496 test dev branch commit 21c9DE4 TXT file. Add nice a3c7c44 To hello. TXT. 32b0ee3 Add hello. TXT to the local repositoryCopy the code

    For example, to tag a commit for Fix bug 66, the corresponding commit ID is EE213a8, type:

    $Git tag v1.1 ee213a8
    Copy the code

    Git stag to check the tag:

    $ git tagV1.0 v1.1Copy the code

    Note that the labels are not listed chronologically, but alphabetically. Git show

    $Git show v1.1Commit ee213a81a0d5ba652d0e8164109e95fffc954518 (HEAD - > master, tag: v1.1, tag: v1.0, issue - 66) Author:... Date:... fix bug 66 diff --git a/hello.txt b/hello.txt index 4a49052.. 6287c7d 100644 -- a/ hell.txt +++ b/ hell.txt @@-1,4 +1,4 @@hellogit! -Git is very nice software! +Git is very good software! creating a new branch.Copy the code

    As you can see, V1.1 is indeed attached to fix Bug 66.

    You can also create a label with a caption, using -a to specify the label name and -m to specify the caption:

    $Git tag-a v1.2-m"version 1.2 released" c4fe80d
    Copy the code

    Git show

    $Git show v1.2Tag v1.2 Tagger:... Date:... Version 1.2 released commit c4fe80dbe89033a6daf33b440ec93470ffc019ab (tag: v1.2) Author:... Date:... Git a/hello.txt b/hello.txtCopy the code

    Note: Labels are always linked to a COMMIT ID. If the commit ID appears on both the Master and dev branches, the label will be visible on both branches.

  • Here is a summary:

    • The commandgit tag <tagname>Use to create a new label. Default isHEADOr you can specify onecommit id;
    • The commandGit tag -a <tagname> -mYou can specify label information.
    • The commandgit tagYou can view all labels.

6.2 Operating Labels

6.2.1 Deleting labels

If we have a wrong label, it can also be deleted:

$Git tag - d v1.2
Deleted tag 'v1.2' (was d0b0a0a)
Copy the code

Because created labels are only stored locally, they are not automatically pushed to remote locations. Therefore, mislabeled labels can be safely deleted locally.

6.2.2 Push a label to remote

  • To push a label remotely, use the commandgit push origin <tagname>:
$Git push origin v1.0Counting objects: 15, done. Delta compression using up to 4 threads. Compressing objects: 100% (9/9), done. Writing objects: 100% (15/15) and 1.33 KiB | 454.00 KiB/s, done. Total 15 (2) the delta, reused zero (0) delta remote: GITEE.COM [gnk-5.0] To GITEE.COM :favorite_canned_fish/test-gitCopy the code
  • Alternatively, push all local tags that have not been pushed remotely at once:
$ git push origin --tagsTotal 0 (delta 0), reused 0 (delta 0) remote: GITEE.COM [gnk-5.0] To GITEE.COM :favorite_canned_fish/test-git. Git * [new tag] v1.1 -> v1.1Copy the code

6.2.3 Deleting a Remote Label

  • First, if the tag has been pushed to the remote, to delete the remote tag is a bit of trouble, first delete from the local:

    $Git tag - d v1.1
    Deleted tag 'v1.1' (was ee213a8)
    Copy the code
  • Then, delete it from remote. The delete command is also push, but in the following format:

    $Git push origin: refs/tags/v1.1Remote: Powered by GITEE.COM [gnk-5.0] To GITEE.COM :favorite_canned_fish/test-git.git - [deleted] v1.1Copy the code

    If you want to see if you really deleted the tag from the remote library, you can check the login code cloud. Here will not take you to see! (Call me lazy haha)

6.2.4 Here is the summary

  • The commandgit push origin <tagname>You can push a local TAB;
  • The commandgit push origin --tagsYou can push all the local tags that have not been pushed;
  • The commandgit tag -d <tagname>You can delete a local tag;
  • The commandgit push origin :refs/tags/<tagname>You can delete a remote label.

7. Wrap up a loose flower

I believe that you have a preliminary grasp of Git. At first, you may find it difficult to get started with Git, but if you practice it a few times, you will become more comfortable with it. Although Git is extremely powerful, many commands, but there are only so many commonly used commands, master these more than a dozen common commands, you can already be handy to use Git.

Here is a summary of our work in the common Git command, if someone skipped directly see here, ha ha I calculate you malicious. He’s a tough guy. Young people don’t talk about martial arts. I hope you have a rat tail.

  • First to enter the company development, the first step is to clone the remote version library to the local it

    Git clone url (SSH)Copy the code
  • The project has been carried out locally, right, but you cannot develop it on the original branch, so you need a branch of Xinjiang to carry out the project development.

    Git checkout -b dev creates the branch dev and switches to itCopy the code
  • Next, you need to add your code to the cache after you have finished developing something in your branch.

    Git add hello.java add the helloWorld.java file to the staging areaCopy the code
  • After adding code to the cache, you need to commit the code in the buffer to the repository.

    git commit -m "It's the first time for a new person to submit it. Hope it's bug free."Commit code and add some commit informationCopy the code
  • During this process, you may need to check the state of the workspace.

    Git status Displays changes in the staging area of the current workspaceCopy the code
  • After submitting, you can view your submitted log.

    Git log to view commit historyCopy the code
  • If you want to compare what you changed

    Git diff shows the difference between staging and workspaceCopy the code
  • What do you think is wrong with your submission and want to go back to the version?

    Git reset commit_id commid_id is the commit_id you get from the logCopy the code
  • If you go back to the latest version and want to go back to the latest version. There are two steps:

    Git reflog step 1: In this file, find your latest commit_id and copy git reset commit_idCopy the code
  • Finally, after you feel no problem, is it necessary to push to the server

    Git push Origin dev pushes all updates for dev to be merged remotelyCopy the code
  • If the remote code is updated, does your local code need to be updated

    Git pull pulls updates from all branches of the remote repository and merges them into the local branch. Git pull origin master merges the remote dev branch to the current local branchCopy the code
  • But in the merge process, encountered version conflict, what to do

    Git merge dev = merge dev = merge dev = merge dev = merge devCopy the code

These are the common commands required for project development.

Here, the world is closed for today, good night! Although this article is over, I am still here, never finished. I will try to keep writing articles. The coming days are long, why fear the car yao ma slow!

Thank you all for seeing this! May you live up to your youth and have no regrets!

Note: If there are any mistakes and suggestions, please leave a message! You can also search for prince Nezha’s public account on Wechat to pay attention to a wave, thank you!