Article From:https://www.cnblogs.com/stdio0/p/9967354.html

It is the so-called Wanzhang high-rise flat ground, which girl does not Huaichun? Many people want to learn how to use Git for multi-person project management, but they can’t eat hot tofu in a hurry, and they can’t eat fat people in a mouthful. We still need to start local personal project management, step by step learning.

Now I’m creating a new file named 2022-02-22.txt in the Git project warehouse folder. For those who are pursuing this file name, I know I’m going to use it to write a log. Now please give full play to your wisdom and write an article for yourself in advance.Chi! I wrote about:
1.png

What’s the matter? Very literary? So the question arises, although I built and wrote a new file in my Git warehouse, how does Git help me manage it? First of all, Git won’t save it for you regularly. You need to communicate with it and let it manage you according to your ideas.Manage your project. Of course, we can’t just say to it: Git, help me save the project! This would be very impolite and not in line with the basic temperament of our socialist successors. We must ask it first: Gee, Git, see if my project has been revised recently.Now? Code means:git status,Direct translation of this English phrase is similar to: Git, how are you doing recently? Is it very polite?
2.png

The answer is: Well, our main branch hasn’t submitted anything yet. There’s a file called 2022-02-22.txt that you haven’t seen before. (If you want to submit it it to my warehouse, use it.)git add<The file name is >Let’s add it. There is nothing else to submit.

Well, Git’s housekeeper’s response to us is very professional, isn’t it? As an aside, many software is not difficult to learn, but our English level limits our learning ability. So it’s very important to learn English well, students!

Okay, according to Git’s butler, we’ll use it.git add 2022-02-22.txtTo add this file to Git’s warehouse, we don’t actually need to use the pointer brackets in its prompt statements:
3.png

If there were no questions, the Git housekeeper would not reply this time, which is equivalent to saying to it: put the file 2022-02-22.txt in the warehouse, and then the Git housekeeper nodded while busy counting things. At this time, we will use it again.git statusAsk the Git housekeeper to see if there is anything else.
4.png

Then the Git housekeeper said, “Well, our main branch hasn’t submitted anything yet. There is a change waiting for submission (you can use it)git rm --cached <The file name is >Let’s put it back where it was.

Uh huh? Didn’t we just add this file according to what it said? Why are you still waiting for submission? Don’t panic, buddies. In fact, we use git add< filename & gt; then, the Git Butler just put the file on its list, only commit.Only after submission does it really move the files to the warehouse. So let’s commit now.
5.png

Here I use it.git commit -m “xxx”To submit the file to the Git repository. Every time you submit a Git Butler will help you produce a version number and record all the information about the current version. Now you can’t see the new version number. You’ll see it later. Don’t worry. And XXX is annotation, when you see it later, you can probably recall what it is now.What do you think and where have you changed? Otherwise, you will feel quite confused when you see nothing in the historical records. Is it weird to see that everyone’s name in the Weixin Friends List is empty? At this time, some students said, ah, add notes.Trouble, can you add a comment? My answer here is: No! Dead this heart! If you search and see people saying that in some ways you can submit commit without annotations, then I can only say, hehe, why do you want to learn bad habits?

ok,After all these long steps (in fact, only three very simple steps, but the mental journey is relatively long), we should be able to confirm that something has been submitted? Reuse this timegit statusLet’s ask Git housekeeper:
6.png

This time the Git housekeeper’s response was brief: Well, the main branch was clean, one was leaky, and all were submitted. Then we can watch TV happily! ~

1 – & gt;”git status View the status of the current Git repository.

2 – & gt; usegit add <The file name is > Add the new files to the list of Git repositories.
3 – & gt” to the XXX annotations for you; usegit commit -m “xxx” Submit all changes to the Git repository and add XXX to it for you.

Leave a Reply

Your email address will not be published. Required fields are marked *