Linux下查看Git的状态

我们修改readme.txt文件,如:

Git is a distributed version control system.
Git is free software.


要了解仓库当前状态,可用“ git status ”,如:

$ 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.txt
#
no changes added to commit (use "git add" and/or "git commit -a")


若要查看修改的内容,可用 “ 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.


版权声明:本文为grace666原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。