git使用记录六:对commit的message做处理

修改最新commit的message

git commit --amend

修改老旧commit的message

查询最新的三个log

soaeon@DESKTOP-FUJJTHR MINGW64 /f/gitstudy (master)
$ git log -n 3
commit 88400d127d5f33df816657cf5765d8e9563c9b88 (HEAD -> master)
Author: soaoen <soaeon@163.com>
Date:   Wed May 22 20:28:29 2019 +0800

    update readme.md

commit 2f3daee92d677983df1b30df5ccd9608d6053051
Author: soaoen <soaeon@163.com>
Date:   Wed May 22 20:27:18 2019 +0800

    rename

commit f51147967743aec46e111a7753cc9a6b7bde9384
Author: soaoen <soaeon@163.com>
Date:   Wed May 22 20:26:36 2019 +0800

    add readme

如果我们要修改32f575d33 这个log的message.,那么要基于它的parent(980e3beda)做查询

git  rebase -i   f511479

执行之后显示的数据如下:

r 2f3daee rename  for readme.md
pick 88400d1 update readme.md

修改完成之后查询log

$ git log -n 3
commit 45c5445ae8fca52276f9ffca685c968f29066c8f (HEAD -> master)
Author: soaoen <soaeon@163.com>
Date:   Wed May 22 20:28:29 2019 +0800

    update readme.md

commit 98e4419eb04aa3ef95e6916948b37b14d67262cc
Author: soaoen <soaeon@163.com>
Date:   Wed May 22 20:27:18 2019 +0800

    rename

        reword 7cc45c7 rename  for readme.md

commit f51147967743aec46e111a7753cc9a6b7bde9384
Author: soaoen <soaeon@163.com>
Date:   Wed May 22 20:26:36 2019 +0800

    add readme

发现log:rename 改成了 reword 7cc45c7 rename for readme.md

原文地址:https://www.cnblogs.com/soaeon/p/10908465.html