Git Bash commit 出现 Aborting commit due to empty commit message

参考文章

https://blog.csdn.net/RobotYa…

https://stackoverflow.com/que…

https://stackoverflow.com/que…

错误复现

  • vim 项目中修改任意文件,正常 wq 保存
  • git commit -a 输入 log 内容后,强制关闭 git bash
  • 再次打开 git bash,输入git commit -a ,此时报错
  • 《Git Bash commit 出现 Aborting commit due to empty commit message》

错误原因

  • 输入 log 内容后,编辑器已经生成了 .swp 文件,而强制关闭会导致 .swp 没有被正确处理
  • 《Git Bash commit 出现 Aborting commit due to empty commit message》

解决方式

  • cd .git
  • ls -al
  • rm .COMMIT_EDITMSG.swp
  • 重新 git commit -a 正常操作即可
    原文作者:RobotYang
    原文地址: https://segmentfault.com/a/1190000014839835
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞