The purpose of the previous article is to let you configure the GIT environment variables, car bought, the next time is to teach you how to drive
1 Git's Zones and libraries
Workspaces, staging area, local warehouses, remote warehouses (i.e. GitHub)
How to understand these four concepts. Let's take a look at the use of Git version control.
Modify your files
Commit to staging area after the modification is complete
Submit to local warehouse after staging area submission
If you need a cloud backup, you can submit it to the remote repository (GitHub)
these four layers are a chain of progressive relationships, layered in-depth
If you have a good memory, you should remember the four statements I said on my last blog:
git status
git Add. (Submitted to staging area after the modification is complete)
Git commit-m "Initialize" (commits to the local repository after staging area is submitted)
Git push (can be submitted to remote repository (GitHub) If a cloud backup is required)
For example:
Work area to staging area said: "Monitor, I wrote the homework, and now to You"
Staging area to the local warehouse, said: "Class teacher, this is the class of students ' homework, you check it"
Local warehouse to remote warehouse said: "Ye, I put 3 years 2 classes of homework in our safe room, who has the key can be copied a copy, but can not take the source files, this matter to you, then I go home first ha"
2 really use Git.
Create a new folder on your desktop named "Test" with a new blank txt file
Right click outside of this blank txt file, select "Git Bash here"
1 Enter "Git init"
This sentence is the meaning of the initialization, each project would have a "monitor, class teacher and guard big" role, you must first use "Git init" to initialize, in order to use Git to pass information between these three roles, each project only need to use one at the beginning of the
2 Enter "git add" shortly thereafter.
This sentence is to give homework to the monitor, pay attention not to forget this ".", it means that all your homework (you can put the number of words out of work divided into three times, can also be handed over, this ".") To show a single hand in each job)
3 after entering "Git commit-m" I received Xiao Ming's homework ""
This sentence is the teacher received Xiao Ming's homework, and notes a little "Xiao Ming's Homework"
Watch out for incredible things to see below.
Create a new TXT in the test folder, called "Little Red", and continue to enter the following commands as described above:
git Add.
Git commit-m "The teacher received little Red's homework"
This time the folder has two people homework, if little Red found himself staggered the exercise book (to the monitor is the physical homework), want to take back how to do it?
(This is the most frequently encountered, often want to revert to a certain version)
Let's take a look at how git operates.
git log View all commit records (notes in Commmit-m)
Git reset–hard de2ded back to "I received Xiaoming's job" This version, this de2de where to come. See the Red Line I painted, you want to go back to which version you can see a commit record, the previous 5 letters can indicate his version number