43
Git如何修改已提交Commit的commit msg
source link: http://www.banbeichadexiaojiubei.com/index.php/2020/10/17/git如何修改已提交commit的commit-msg/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
在使用Git提交代码之后,有时候我们需要修改提交的Commit Msg,这时候需要如何操作呢?
Git中的git commit –amend可以帮助我们实现这个目的。
git commit --amend
进入编辑界面:
git 默认的编辑器是Nano编辑器,刚开始我还一脸懵逼,不知道怎么操作。
这里我们只需要直接修改commit msg即可。比如我们修改”add demo commit”为”add demo commit, modify!”。
编辑完成之后,按下ctrl+x键,进入如下界面:
输入”Y”,按回车(enter)键:
至此,commit msg修改完毕。
Nano的编辑器还是使用的不多,还需要去研究怎么使用,不想浪费时间的同学可以直接把编辑器切换为vim,回到自己熟悉的环境和命令。
切换git编辑器的方法为:
git config --global core.editor vim
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK