https://backlog.com/git-tutorial/cn/stepup/stepup7_1.html

 

 

为了节省时间,这个教程使用现有的历史记录作为本地数据库。

从这里下载

我们将修改最近一次的提交。

首先进入stepup-tutorial/tutorial1目录。本地端的历史记录状态如下图显示。

commit --amend

用log命令确认历史记录。

$ git log
commit 326fc9f70d022afdd31b0072dbbae003783d77ed
Author: yourname <yourname@yourmail.com>
Date:   Mon Jul 16 23:17:56 2012 +0900

    添加add的说明

commit 48eec1ddf73a7fb508ef664efd6b3d873631742f
Author: yourname <yourname@yourmail.com>
Date:   Mon Jul 16 23:16:14 2012 +0900

    first commit

首先打开sample.txt档案,并添加commit的注释。

连猴子都懂的Git命令
add 把变更录入到索引中
commit 记录索引的状态

添加 --amend 选项,然后提交。

$ git add sample.txt
$ git commit --amend

编辑工具会显示最近一次提交的提交消息,把消息修改为「添加add和commit的讲解」并进行保存。

现在已经修改了提交的内容,然后用log命令确认历史记录和提交消息。

commit --amend

$ git log
commit e9d75a02e62814541ee0410d9c1d1bf47ab1c057
Author: yourname <yourname@yourmail.com>
Date:   Mon Jul 16 23:17:56 2012 +0900

    添加add和commit的讲解

commit 48eec1ddf73a7fb508ef664efd6b3d873631742f
Author: yourname <yourname@yourmail.com>
Date:   Mon Jul 16 23:16:14 2012 +0900

    first commit

相关文章:

  • 2021-06-22
  • 2021-08-13
  • 2021-11-29
  • 2022-02-19
  • 2021-05-28
  • 2021-12-29
  • 2021-10-28
猜你喜欢
  • 2022-02-02
  • 2021-06-06
  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
  • 2021-07-24
  • 2021-09-19
相关资源
相似解决方案