git status
命令可以让我们时刻掌握仓库当前的状态
git diff
看到具体的修改内容
$ git diff readme.txt
diff --git a/readme.txt b/readme.txt
index 46d49bf..9247db6 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,2 +1,2 @@
-Git is a version control system.
+Git is a distributed version control system.
Git is free software.
提交修改和提交新文件是一样的两步:
- (1) git add
git add readme.txt
- (2) git commit
$ git commit -m "add distributed"
[master ea34578] add distributed
1 file changed, 1 insertion(+), 1 deletion(-)
总结:
- a 要随时掌握工作区的状态,使用 git status 命令
- b 如果git status告诉你有文件被修改过,用git diff可以查看修改内容。