【发布时间】:2011-02-05 07:22:49
【问题描述】:
我想要一个提交消息清理,它不一定会删除消息本身中以# 开头的行。默认的--cleanup=strip 删除以# 字符开头的所有 行。
不幸的是,Trac 引擎的 wiki 格式化程序在代码块的开头使用哈希来表示语法类型。在我的提交消息中使用引擎的语法时,这会造成困难。
例子:
Created demo of perl added to helloworld.pl
{{{
#!/usr/bin/perl
use strict;
# say hi to the user.
print "hello world\n";
}}}
# 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^1 <file>..." to unstage)
#
# added: helloworld.pl
# and so on and so forth...
我希望在最终记录的提交消息中得到以下结果:
commit 1234567890123456789012345678901234567890
Author: Danny <...>
Date: Wed Apr 7 13:34:29 2010 -0400
Created demo of perl added to helloworld.pl
{{{
#!/usr/bin/perl
use strict;
# say hi to the user.
print "hello world\n";
}}}
我想使用一个自定义过滤器,从提交消息的底部向上删除所有以哈希开头的行。留下我单独添加的消息中的行。我可以在 git 的哪里或如何指定它?
注意,创建一个 sed 或 perl 脚本来执行操作不是问题,只需要知道 在哪里将其挂钩到 git 中。
对于我的问题的混乱,我深表歉意,我没有意识到它有多么含糊。
【问题讨论】:
-
@Danny:我很确定您在问这个关于提交消息清理的问题(由 git-commit 标记和“...嵌入提交消息中...”) -但是您的示例看起来不太像提交消息,并且您说的是“文件底部”,而不是“消息底部”。假设我的解释是正确的,您可能希望将示例扩展为完整的提交消息,并稍微澄清一下您的措辞。
-
这个问题是关于提交信息的,我已经尝试相应地澄清它。
标签: git trac git-commit