有时候提交过一次记录只有,又修改了一次,仅仅是改动一些较少的内容,可以使用git commit --amend. 添加到上次提交过程中;

    --amend               amend previous commit
git commit --amend  # 会通过 core.editor 指定的编辑器进行编辑
git commit --amend --no-edit   # 不会进入编辑器,直接进行提交

如果你之前没有配置 core.editor 选项的时候,会出现:

error: There was a problem with the editor 'vi'. 
Please supply the message using either -m or -F option.

这个时候,你通过 git config 命令,配置全局变量,指定特定的编辑器就解决报错了;之后再进行git config --amend 命令来进行编辑;

git config --global core.editor /usr/bin/vim

保持更新,转载请注明出处。更多关于linux和分布式系统相关的知识,请关注 cnblogs.com/xuyaowen 

相关文章:

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