如何编辑默认的 git 合并消息
How can I edit the default git merge message
从 1.7.10 版本开始,我现在必须在合并上游提交时提供一条消息。
有没有办法修改这条消息的默认内容?
每次合并都是简单的删除评论保存
我想永久删除该部分。
不过,我不希望使用 mergeoptions = --no-edit 完全关闭消息功能。
Every time I merge, I am simply deleting the comments and saving.
您可以使用 commit -m
命令将任何消息作为您的提交消息传递。
Git 提交时不允许空消息。
commit.template
有commit.template
配置变量。
Specify a file to use as the template for new commit messages.
"~/" is expanded to the value of $HOME and "~user/" to the specified user’s home directory.
在你的具体情况下,你说你正在删除评论并保存。这是不必要的步骤 - 以 # 开头的行自动从消息中排除:
$ git commit
1 Commit title
2
3 Some message content
4
5 #A comment
6
7 Some more message content
8
9 # Please enter the commit message for your changes. Lines starting
10 # with '#' will be ignored, and an empty message aborts the commit.
11 # On branch master
12 # Changes to be committed:
13 # new file: b
14 #
$ git log
commit ceb148a2c26236b0e72e6befa818bce83f252a9a
Author: Me
Date: Fri Jan 29 07:27:03 2016 +0200
Commit title
Some message content
Some more message content
从 1.7.10 版本开始,我现在必须在合并上游提交时提供一条消息。
有没有办法修改这条消息的默认内容?
每次合并都是简单的删除评论保存
我想永久删除该部分。
不过,我不希望使用 mergeoptions = --no-edit 完全关闭消息功能。
Every time I merge, I am simply deleting the comments and saving.
您可以使用 commit -m
命令将任何消息作为您的提交消息传递。
Git 提交时不允许空消息。
commit.template
有commit.template
配置变量。
Specify a file to use as the template for new commit messages.
"~/" is expanded to the value of $HOME and "~user/" to the specified user’s home directory.
在你的具体情况下,你说你正在删除评论并保存。这是不必要的步骤 - 以 # 开头的行自动从消息中排除:
$ git commit
1 Commit title
2
3 Some message content
4
5 #A comment
6
7 Some more message content
8
9 # Please enter the commit message for your changes. Lines starting
10 # with '#' will be ignored, and an empty message aborts the commit.
11 # On branch master
12 # Changes to be committed:
13 # new file: b
14 #
$ git log
commit ceb148a2c26236b0e72e6befa818bce83f252a9a
Author: Me
Date: Fri Jan 29 07:27:03 2016 +0200
Commit title
Some message content
Some more message content