Aborting commit due to empty commit message.
Could not amend commit after successfully picking 5e9159d9ce3a5c3c87a4fb7932fda4e53c7891db... 123 salt hashed passwords
This is most likely due to an empty commit message, or the pre-commit hook
failed. If the pre-commit hook failed, you may need to resolve the issue before
you are able to reword the commit.
You can amend the commit now, with
git commit --amend
Once you are satisfied with your changes, run
git rebase --continue
所以,只需修改消息:
git commit --amend -m "#123 salt hashed passwords"
--cleanup=<mode>
scissors
Same as whitespace, except that everything from (and including) the line
"# ------------------------ >8 ------------------------" is truncated if the message
is to be edited. "#" can be customized with core.commentChar.
8 回答
此行为是
git commit
's default '清理行为的一部分 . 如果要保持以#
开头的行,可以使用其他清理模式 .例如 .
如果这样做,则必须小心删除不希望出现在提交中的所有
#
行 .请注意,从git1.8.2 (February 2013)开始,您可以使用与“
#
”不同的字符作为提交消息中的注释行 .这允许您使用'
#
'作为您的错误编号参考 .从理论上讲,你可以放一个
core.commentChar
字(多个字符),但git 2.0.x / 2.1会更严格(2014年第三季度) .见commit 50b54fd由Nguyễn Thái Ngọc Duy (pclouds):
config:对core.commentChar严格控制
git 2.0.x / 2.1(2014年第3季度)将为
core.commentChar
添加自动选择:见commit 84c9dc2
“auto”的候选字符列表是:
这意味着像
git commit -m '#1 fixed issue'
这样的命令会自动将commentChar切换为提交消息中使用的';
', because '#
' .这里的答案是好的和详细的,但对于像我这样的git noob定制git配置选项并不是那么明显 . 以下是从
#
更改为;
以查看注释字符的示例:这就是你需要做的 .
您可以使用命令行选项
-m
:如果你正在进行交互式rebase,那么当你保存提交消息时没有任何内容(因为开头的
#
已经使它成为评论,因此它被忽略了)git将告诉你该怎么做:所以,只需修改消息:
继续坚持:
应该使用
git commit --cleanup=scissors
. 它已于2014.05.21添加到Git v2.0.0来自
git commit --help
为票号使用不同的前缀 . 或者在单词前面添加一个单词,例如“Bug#42” . 或者在行前加一个空格字符;如果你想删除那个空格,可以为它添加一个commit-hook .
我个人宁愿没有钩子完成这种提交消息操作,因为当你不想要它时它会触发它会非常恼人 . 最简单的解决方案可能是重新思考问题 .
我的所有提交都以
#issueNumber
开头,所以我把这个样板放到我的vim .git/hooks/commit-msg
:所以我们假设我们有分支
#15
并且我们进行提交消息add new awesome feature
. 使用此方法,最终提交消息将为#15 add new awesome feature
.