问题描述
如何在不指定提交消息的情况下提交更改?为什么默认情况下需要它?
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命令。您可以在。
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提交没有提交消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!