为什么当我重述上一次提交消息时,git称我“聪明”?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (24)

git commit --only --amend

来重写我所做的最新提交的提交消息。不管我的工作目录是否干净,这都是可行的。

今天,我注意到在执行此操作时,写入提交消息的默认指令显示在core.editor包括以下评论:

# Clever... amending the last one with dirty index.
提问于
用户回答回答于

我认为这可能是最初的提交消息:

git-commit --amend: two fixes.

When running "git commit --amend" only to fix the commit log
message without any content change, we mistakenly showed the
git-status output that says "nothing to commit" without
commenting it out.

If you have already run update-index but you want to amend the
top commit, "git commit --amend --only" without any paths should
have worked, because --only means "starting from the base
commit, update-index these paths only to prepare the index to
commit, and perform the commit".  However, we refused -o without
paths.

Signed-off-by: Junio C Hamano <junkio@cox.net>

我不是很精通,但在我看来,这确实是一种真正的赞美,因为它通过使用--only without paths

扫码关注云+社区