-
Git 跟踪管理的是修改 不是文件 下面来做测试
-
修改仓库中的readme.pages文件 添加一行内容
Git is a distributed version control system.
Git is free software distributed under the GPL.
Git has a mutable index called stage.
I’m jiayuanfa.```
- 添加 但是不提交文件
git add readme.pages
git status```

- 下面继续修改 再添加一行文字
Git is a distributed version control system.
Git is free software distributed under the GPL.
Git has a mutable index called stage.
I’m jiayuanfa.
I’m hailiting..```
- 这次我们不Add 直接提交
git commit -m "change readme.pages file 4:22"```

- 提交之后 看下状态
git status``

发现我们第二次修改的内容没有被提交,为什么呢?因为我们第二次修改的内容没有放到暂存区。git commit命令提交的内容都是暂存区的内容。
- 提交后,用git diff HEAD -- readme.txt
命令可以查看工作区和版本库里面最新版本的区别:
git diff HEAD -- readme.pages```
-
现在我们把第二次的修改也提交
Paste_Image.png
总结
git add 是到缓存区
git commit才是到工作区
网友评论