接着上面的git版本管理系列(一),继续完成git的接下来的操作
我们继续修改readme.txt文件
first add.
second add something.
使用git status 查看当前仓库的状态
nelsen-mac:learngit mac$ 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.md //告诉我们,这个文件被修改了
no changes added to commit (use "git add" and/or "git commit -a")
还可以使用git diff
这个命令查看修改的不同之处
nelsen-mac:learngit mac$ git diff
diff --git a/readme.md b/readme.md
index d107973..9a55b32 100644
--- a/readme.md
+++ b/readme.md
@@ -1 +1,2 @@
first add.
+second add something.
然后再次添加我们的文件到本地暂存区
nelsen-mac:learngit mac$ git add readme.md
nelsen-mac:learngit mac$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: readme.md
下一步,就可以放心地提交了
nelsen-mac:learngit mac$ git commit -m'second add.'
[master c52921e] second add.
1 file changed, 1 insertion(+)
再使用 git status 查看当前仓库的状态,下面的提示说明当前的仓库没有新的需要提交的修改,工作目录是干净(working tree clean)的
nelsen-mac:learngit mac$ git status
On branch master
nothing to commit, working tree clean