Git 修改提交(commit)信息(message)

2,945 阅读1分钟

1.修改当前commit的message

git commit -am "修改了一下"
 [dev 88a4aa8] 修改了一下
 8 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100644 web/src/main/java/com/hello/web/DemoController.java

此时看到的提交信息是:“修改了一下” 接下来我们来修改这个提交信息。

使用命令:

git commit --amend

出现如下界面:

修改了一下

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      Mon Apr 29 09:38:58 2019 +0800

对提交信息修改如下:

添加查找图书功能
  
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      Mon Apr 29 09:38:58 2019 +0800

保存如下:

➜  blog git:(dev) git commit --amend
 [dev b201317] 添加查找图书功能
 Date: Mon Apr 29 09:38:58 2019 +0800
 8 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100644 web/src/main/java/com/hello/web/DemoController.java

这样就改好了,commit的id也会跟着改变.