快速浏览 git-commit 和 git-config 文档并没有揭示这样一个特定的选项。
但是,您可以指定一个 git 别名来执行此操作:
# the --global flag means this works now everywhere, not just in the current repo.
git config --global alias.committ "commit --allow-empty"
# Now use like this:
git committ -m "my empty commit, with a message"
当我写这个答案时,问题被编辑了。为了完整起见,我将其留在这里,因为未来的访客可能会对此感到满意。
我尝试覆盖
alias.commit
本身,而不添加额外的 t
。这似乎没有任何效果。