在CLI中运行git commit时会显示以下(默认)模板(在任何使用的编辑器中):
[empty line]
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up to date with 'origin/master'.
#
# Changes to be committed:
# modified: Makefile
#
这允许用户(a)查看将受提交影响的项目列表,以及(b)提供多行消息。特别是,通常有一个短(<72个字符)的第一行。空行然后是更长的消息。
从vscode中提交时,我找不到为提交消息提供完整编辑器的方法。所有人都有类似以下内容:
多行消息是可能的,但没有编辑的乐趣。
我目前正在使用1.23.1。
但是,vscode在提交消息长度上显示警告消息:https://github.com/Microsoft/vscode/issues/18807
那个编辑就是必要的。您的第一行将用作消息,正如您所说,应该简洁。
多行消息(即包含换行符的消息)将自动将第二行及其后的行视为GitHub等服务的“描述”。
如果你真的想避免使用这个编辑器,我建议你查看this answer。