英文:
How to commit without message in Git?
问题
GitHub强烈建议使用消息,但我与兄弟在同一个房间一起开发半公开项目,显然不需要注释我们的提交。是否有其他选项可以完全禁用提交消息,至少对于特定的存储库/项目/文件?
我找到了这个命令来创建一个空提交:git commit -a --allow-empty-message -m ""
,它运行得很好,但我已经厌倦了每次输入它。
英文:
I know that GitHub highly recommends to use messages BUT I work on semi-public projects with my brother and we are working in the same room so obviously we don't need any comments to our commitments. Are there any other options to completely disable commitment messages at least for the specific repository/project/file?
I found this command to make a single commitment: git commit -a --allow-empty-message -m ""
and it works pretty well but I'm already tired of typing it every time.
答案1
得分: 5
我不太确定为什么你每次都想要提交没有消息,因为Git的整个理念是跟踪代码。你可能会想要为这个命令创建一个别名,以免每次都必须手动输入它。
我没有测试过这个,但类似这样的命令可能会有用:
git config --global alias.cm "commit -a --allow-empty-message -m ''"
然后你可以运行 git cm
来代替。有关别名的更多信息,请参考这里。
英文:
I'm not entirely sure why you would want to commit without a message every time since the whole idea of Git is to track code. You'll probably want to create an alias for the command to prevent you having to type it every time.
I haven't tested this, but something like:
git config --global alias.cm "commit -a --allow-empty-message -m ''"
then you would run git cm
instead. See here for more information on aliases.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论