时光机穿梭
2016-06-30 本文已影响21人
952625a28d0d
- 我们已经成功地添加并提交了一个readme.txt文件,现在,是时候继续工作了,于是,我们继续修改readme.txt文件,改成如下内容:
Git is a distributed version control system.
Git is free software.```
- 现在,运行git status 命令看看结果:
appledeMacBook-Pro:GitRespository JiaYuanFa$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: readme.pages
Untracked files:
(use "git add <file>..." to include in what will be committed)
.DS_Store
no changes added to commit (use "git add" and/or "git commit -a")
appledeMacBook-Pro:GitRespository JiaYuanFa$ ```
git告诉我们修改了内容,我们用git diff查看修改了什么内容
git giff```

#####提交修改和提交新文件是一样的两步,第一步是git add
:
git add readme.pages```
同样没有任何提示,说明成功了

- 在执行第二步git commit 之前,我们再运行git status看看当前仓库的状态:
git status```
可以看到文件被修改

提交
git commit -m "change redeme.page file"```
提交成功!

- 提交之后 再次通过 git status 查看状态
git status```
git 告诉我们没有什么可提交的

###总结
要随时掌握工作区的状态,使用git status命令。
如果git status告诉你有文件被修改过,用git diff可以查看修改内容。