preface

On Saturday, I found a video of Linus giving a Google talk and posted it to my friends:

If you are interested, you can check it out. It’s not boring

www.bilibili.com/video/BV1xb…

Several people asked about my girlfriend in the comments on wechat

I also happened to teach my girlfriend what Git is, so this article was born.

Git is introduced

What is Git used for? It is version control software.

Git is a popular technology. I don’t know if she understands it or not, but she always tells me something about it.

At that time, she told Sanwei one day, “I haven’t saved my Excel yet, so my computer has a blue screen of death and I lost everything.

Hence three crooked say: this… I haven’t used much Excel or anything like that. How about WPS or Office? Is there a backup function or automatic saving?

WPS is a backup (automatic preservation) function, what time to define their own.

This situation if in the hands of programmers feel the probability of occurrence will be lower, programmers used to press CTRL + S. Sometimes I even press CTRL + S while looking at a web page. However, tools like our code (IDEA) do not have to manually save….

After a while, she said she couldn’t find the blue screen and didn’t set autosave.

We write code and version control software, which records every change and who changes what. Whoever corrects, whoever takes the blame, no one gets away!

His girlfriend, who was listening to the three cocks, seemed interested: “What’s version control? Is it that good? Accountants often take the blame.”

Three crooked: “in fact, there is nothing, is that we generally write code is often a collaboration of many people. Your accountant may be responsible for a spreadsheet (Excel) each person, and then pass the completed spreadsheet to the next person. We’re all working on the same project. We don’t wait for one person to finish it and the other person to start.”

Girlfriend: “Huh? And then?”

Sanwei: “You can understand that several of us will be writing code in the same directory, which may make changes or add files. Anyone on the project team can make changes to the catalog, and when they’re done we’ll submit it and launch it.”

Girlfriend: “What? Are you missing the point? What does that have to do with launching a live system?”

Three crooked: “oh, I still cite an example. For example, when we write a paper, we may have to revise the paper constantly. Our revision is based on the original basis.”

Sanwei continued to add: “Because we are afraid that in the original basis of the wrong things, can not recover, so, we may have more than one” graduation thesis “file. When we write code, we are “multi-player” and changes are inevitable. We don’t want multiple files, but we want to be able to record every change. “

Three skew: “Changed content refers to what was changed based on what was already there and who committed it. That way, we can’t get rid of it. In other words, we know what was changed and by whom.

Three crooked: “arrive here, have a problem?”

Girlfriend: “Yeah, sure, go ahead.”

Three crooked: “Each change” we call a version, it can be implemented from version to version back and forth. For example, I write an article for a week, and there are 10 versions of it, and I can go back to whatever version I want. So it’s called version control software.”

Girlfriend: “I basically understand that every change will be recorded, and then you can know what is changed in each version and who changed it. If you make a mistake, you can use this software to go back to the version you want.”

Three crooked: “Well, that’s what it means.”

Girlfriend: “That I want to ask a question, you keep referring to the” multi collaboration “is in the same directory to modify the file, and then can see what each other changed. So you did it on your computer, your colleague did it on his computer, how did you see what each other did? Is there anything that powerful around here now? “

Three crooked: “oh ~ your meaning probably be: we don’t network again, how know the other party changed what, be this meaning? “

Girlfriend: “Well, yes”

Three crooked: “your understanding is right, we don’t network between, is no way to know the other party changed what. I left out the point that at a certain point (we’re done with this feature, and maybe almost), we’ll commit the current version to a remote repository.”

Sankei added: “What can be found is that after submitting the data to the remote warehouse, even if our computer breaks down, we can pull it back from the remote warehouse.”

Girlfriend: “So? Remote repository to me sounds like a backup feature, right? How do you know what the other person changed?”

Sanwei: “Well, when we pull code from the remote repository, we sync all the changes to our own computer as well as the changes. So we know what each other changes.”

Girlfriend: “Listen very useful ah, I usually use word and Excel can use this software? Even if my computer crashes, I can still go to the remote repository and get the data I submitted last time, and have what you call “version control.” And can backup, and can know every time to modify what, very easy to use ah! “

“Unfortunately, it may not be useful or suitable for a job like yours.”

Girlfriend: “Why? “

Before, I also tried to save my local post with a scheduled task +GitHub, which was blasted after I sent it out. GitHub is a remote repository for scheduled tasks that I want to save once in a while.”

Girlfriend: “I see, you want the backup function, right? Why was it sprayed? “

Three crooked: “they say I blind whole, this every once in a while to submit to GitHub, network overhead can be how big ah. And give me a list of products, like nutcloud, Dropbox, OneDrive, and so on.

Girl friend: “that you how not use? “

Three crooked: “I which know, have information bad of. Anyway, I thought I had written a timed task, so I didn’t think much about it. “

Girlfriend: “That you are real food”

Three crooked: “Oh”

Sancrooked: “In addition to the automatic synchronization mentioned above, your Word and Excel can not check the historical version records with our tools.”

Girlfriend: “Why? Didn’t you say you could write code? Why can’t you check word and Excel? “

“The file types of the code we write are all text files, while your Word and Excel are binary files in nature, so it is difficult to compare the difference of each modification, so it is not supported.”

Girlfriend: “So you say, in my scenario this” version control software “is useless, it can’t record the difference between versions of files like Word and Excel, if you want to use it as a backup, it is better than the existing cloud products. “

Three crooked: “Well, yes. Now that cloud products offer version control, you can just use them. It’s also important to note that it has a learning cost and not everyone will use it. “

Girl friend: “listen to you say so much, like cloud product very line, why you still” bigotry “go to use what you say of that thing? “

“The main thing is that we will have more problems writing code, and the version control software we use will be more flexible and it will support more features.”

Girl friend: “rightness, you all said so long, you use that software call what?”

Three crooked: “Git”

Three slanting guff

Actually, I wanted to directly talk about Git commands that I often use in my work, but I found it difficult to write

Most of the people who read the article are college students. They may not understand Git very well, and they may not understand the command directly. Therefore, they separate the two articles.

In the next article, I will tell you how to use Git in my work.

Summary of various knowledge points

The following articles have the corresponding original exquisite PDF, in the continuous update, you can come to me to urge more ~

  • The 92 – page Mybatis
  • Multithreading on page 129
  • 141 pages of the Servlet
  • The JSP page 158
  • A collection of 76 pages
  • 64 pages of JDBC
  • 105 pages of data structures and algorithms
  • The Spring of 142 pages
  • Filters and listeners on page 58
  • 30 pages of HTTP
  • For SpringMVC on page 42
  • Hibernate
  • AJAX
  • Redis
  • .

Open source project (8K+ STAR) :

  • GitHub
  • Gitee access is faster

I am three crooked, a man who wants to become stronger, thanks for your likes, favorites and forwarding, see you next time.