ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Git,比较暂存区域和工作副本

2022-02-06 15:31:33  阅读:188  来源: 互联网

标签:git instruction should add Git So now 暂存 副本


我们创造了一个文件,名叫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:

 

 

 

 

 

 

 

标签:git,instruction,should,add,Git,So,now,暂存,副本
来源: https://www.cnblogs.com/EvanTheGreat/p/15865712.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有