上一节我们提交了一个hello.txt文件到版本库,现在我们继续修改hello.txt文件将hello git改成hello my git
1、运行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: hello.txt
no changes added to commit (use "git add" and/or "git commit -a") git status命令可以查看当前仓库的状态,上面的效果告诉我们hello.txt文件已经被修改了,但是没有未提交做准备(就是说连add都没有,只是单独被修改了)。
2、我们想看修改了什么可以用git diff命令
$ git diff hello.txt
diff --git a/hello.txt b/hello.txt
index 00cb4c9..6bf1990 100644
--- a/hello.txt
+++ b/hello.txt
@@ -1,2 +1,2 @@
hello world
-hello git
\ No newline at end of file
+hello my git
\ No newline at end of file
上述结果告诉我们hello world没有变,hello git被删了,新增了一个hello my git
3、我们看完都有哪些变化后就可以放心的提交了,老规矩先git add后git commit
4、提交后在运行git status查看状态$ git status # On branch masternothing to commit (working directory clean)