我们创造了一个文件,名叫Tuna,金枪鱼。然后在里面有几个文件,如图:
现在,我们打开第一个first.txt文件,里面内容如下:
现在,我们来修改这个文件里面的内容,修改如下:
好了,我们用git工具来看一下,现在我们进入这个文件夹:
我们输入命令:git status:
So now we try to type in:git add first.txt:
Notice before that:this file we are operating now is named "first" with ".txt" as its extension name.
So this is what happened next:
Nothing happened.We can't see anything happening simply from the screen,but something is happening somewhere we can't see or feel.
Now we try to type in:git diff:
Why?because that the instruction "git diff" simply compares your repository against your woking copy,but the instruction "git add blablabla" simply adds the changes made to the file to the staging area.That's why nothing happens when you type in just that.
Of course this is not good for us to use.We surely want to compare more than this.So,you add a little bit more to the tail of that instruction and everything will be solved.What is it that we should add to the tail of the original instruction?Simple."git diff --staged" will work this time.
Like this:
See what happens?Sometimes you could miss the "minus minus" just like what I did,which is absolutely fatal.So you should never miss it.
Okay,we are good now,because we are comparing the staging area and our working copy now.
That should do it.
Oh,don't forget the final instruction "git commit -m 'blablabla'" to complete the process: