首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >git :如何取消默认提交消息文本的注释?

git :如何取消默认提交消息文本的注释?
EN

Stack Overflow用户
提问于 2012-03-23 05:24:03
回答 1查看 2.1K关注 0票数 0

默认的git提交消息是:

代码语言:javascript
复制
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   file1
#   modified:   file2
#

这对我来说很好。但在默认情况下,我更喜欢有一些行没有注释:

代码语言:javascript
复制
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
 On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)

    modified:   file1
    modified:   file2
#

这样我就不必每次都取消注释了。有可能吗?

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-03-23 05:34:19

此信息很容易生成。不要在提交消息中包含此信息,因为它所能做的就是与提交中的实际更改不同步。相反,让git生成您稍后需要的信息。例如,git log --name-status将显示哪些文件被修改。您甚至可以在.gitconfig中设置一个alias,将这些选项设为默认值。这种方法可以为您提供所需的所有信息,同时避免可能出现的陷阱和违反git约定的情况。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9830769

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档