This article talks about git partition management. If you don’t know about git partition management or are interested in git partition management, then let’s take a look at this article together. Okay, enough nonsense. Let’s get to the point
To understand the basic operation and use of git, let’s first understand what a git partition is? What is the complete submission process? First look at the picture below
A brief explanation, the directory for this demonstration is the gitTest directory
The remote github directory is as follows:
##First , the git partition is divided into three areas, as shown in Figure 1, work area: where the code (file) is edited; temporary storage area: where the files are temporarily cached. Why do we need a staging area? In fact, compared with SVN, there is no concept of staging area in SVN. Code is submitted directly from the work area to the version area, but this has disadvantages. In git, the role of the temporary storage area is:
1. In order to avoid some misoperations during the work process, protect the work area and version area (version rollback and undo)2. Branch processing can be performed
Take submitting test.txt as an example. After the development of test.txt is completed, first check it through git status The
status of the current workspace
##At this time, a newly added file is displayed as Red test.txt, after executing git add test.txt to add the file to the cache area, execute git status to view the status of the cache area
The green newly added files are displayed above, indicating that the files have been added to the cache area.
Then submit the files in the cache area to the version area, and execute the commit through the git commit -m "submit instructions" command
#After completion, you can use the git push origin master command to submit the files in the version area to the remote github repository.
The submission was successful at this time! Check it out on github~~~
##over~~~ Mainly understand the functions of the three areas. The next operation will be smooth and smooth.
The above is all the content of this article. If you don’t know much about it, you can easily master both sides by yourself!
Related recommendations:
Common phrases for Git
How Host your own maven project on github
The above is the detailed content of Detailed explanation of git partition management. For more information, please follow other related articles on the PHP Chinese website!