一、修改文件
将文件内容:
This is first sentence. This is second sentence.
修改为:
This is my first sentence. This is my second sentence.
二、查看当前状态
$ 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 readme.txt
提示一下内容:
diff --git a/readme.txt b/readme.txt index 78762af..6991a86 100644 --- a/readme.txt +++ b/readme.txt @@ -1,2 +1,2 @@ -This is first sentence. -This is second sentence. \ No newline at end of file +This is my first sentence. +This is my second sentence. \ No newline at end of file
四、再一次添加到仓库
$ git add readme.txt
五、再一次提交到仓库
$ git commit -m "update readme.txt"
提示一下内容:
扫描二维码关注公众号,回复:
217994 查看本文章
[master aba1751] update readme.txt 1 file changed, 2 insertions(+), 2 deletions(-)
则提交成功!