This tutorial are actually for myself as some memos. It provides some example and explanation for the most important commands which might being simple but are worth noting down fo R your long term memory. I am not going to write tons of commands and their appending complex options, but some of examples that could is easy to u Nderstand and enough for your daily work at the most of time. I hope they can reflect the backbone of Git and expire you-draw your own diagram for this wonderful version control sys Tem in your mind.
Long-to-go, but step by step. Here we go ...
Before we touch Git, I find necessary and important to take a look at the picture below
Figure 1.1
This was very clear for your to understand what typical architecture Git was about. That's of course very different from any previous version control systems I ' ve ever used such as VSS (Microsoft Visual Sour Cesafe) and TFS (Microsoft Team Foundation Server).
Please try the sure you have installed Git bash. This was a cool tool in the terminal I am going to play when going through the tutorials.
As the picture below we can see, there is 3 files in the the Folder/g/html5/openoffice. Trust me there is no more file even start with dot (.)
Figure 1.2
That's the folder I want to create repository where the files is going to being managed by Git.
Let's type the command to create a repository
Git init
After running the command, system would create a folder calls. Git in the folder where you want to create repository, as sh Own below
Figure 1.3
Since the new folder name starts with a dot (.), you might don't see it in the Explorer unless your set the folder Options by Checking item ' Show hidden files, folders, and drives '. But if you don't like to change the setting, it doesn ' t matter. Typing the command LS with option-a could show you all the hidden files and folders if they is over there as I did in the Terminal.
I am about to add these 3 files to the Staging area. Take a-look-back at the figure 1.1, and guess which command we is about to type. Yes, that's command add as the picture shown obviously.
git add--all
Or
git Add.
Type command status to show the result after running command add
git status
Figure 1.4
If you find your ' ve done something wrong by adding more than you need, for example here, list.png are not supposed to be add Ed, can undo the command add by running command RM
RM --cached list.png
Or even you want to undo all of the them you ' ve added to staging is, you can run this
RM --cached *
Figure 1.5
As the picture shows the 3 files has already come out of staging area and back to untracked files.
Git Tutorial 1-goto Staging Area