Git学习笔记-2

一、修改文件

将文件内容:

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"

 提示一下内容:

[master aba1751] update readme.txt
 1 file changed, 2 insertions(+), 2 deletions(-)

 则提交成功!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值