Git提交没有提交消息 [英] Git commit with no commit message

查看:139
本文介绍了Git提交没有提交消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不指定提交消息的情况下提交更改?为什么默认情况下需要它?

解决方案

git通常需要非空消息,因为提供有意义的提交消息是好的开发实践和良好的知识库管理。提交消息的第一行用在git中的所有地方;有关更多信息,请阅读关于Git提交消息的注意事项

如果您打开Terminal.app, cd 到您的项目目录,并且 git commit -am'',你会看到它失败,因为不允许空的提交信息。较新版本的git具有

- allow-empty-message 命令行参数,包括最新版本的Xcode附带的git版本。这将允许你使用这个命令来提交一个空的消息:
$ b

git commit - a --allow-empty-message -m''

之前, --allow-empty-message 标志,你必须使用 commit-tree plumbing命令。您可以在 中看到使用此命令的示例href =http://book.git-scm.com/ =noreferrer> Git book


How can I commit changes without specifying commit message? Why is it required by default?

解决方案

git generally requires a non-empty message because providing a meaningful commit message is part of good development practice and good repository stewardship. The first line of the commit message is used all over the place within git; for more, read "A Note About Git Commit Messages".

If you open Terminal.app, cd to your project directory, and git commit -am '', you will see that it fails because an empty commit message is not allowed. Newer versions of git have the
--allow-empty-message commandline argument, including the version of git included with the latest version of Xcode. This will let you use this command to make a commit with an empty message:

git commit -a --allow-empty-message -m ''

Prior to the --allow-empty-message flag, you had to use the commit-tree plumbing command. You can see an example of using this command in the "Raw Git" chapter of the Git book.

这篇关于Git提交没有提交消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆