git版本管理系列(二)

接着上面的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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章