在git中为相同的文件应用多个过滤器

时间:2012-12-21 10:44:54

标签: git version-control filter gitattributes

我正在使用Git进行本地文件的版本控制,最终必须将其签入另一个版本控制系统。现在我遇到了大多数C代码文件的一些问题:

  1. 他们在标题评论中都有自动版本历史记录
  2. 大多数文件都被EasyCode或EasyCase评论混乱
  3. 我现在只需创建两个git过滤器“History”和“EasyTool”来清理代码,然后再将其签入Git。如何用两个过滤器过滤所有C和H文件?

    多次指定命令不起作用,并且filter命令的连接既没有(或者我至少没有找到正确的语法)。

    这是我的第一次尝试:

    *.c  filter=History
    *.c  filter=EasyTool           # This one wins, "History" is not executed
    

    然后我尝试了这样的事情:

    *.c  filter=History EasyTool   # The first wins, other separators work neither
    

1 个答案:

答案 0 :(得分:3)

我认为你不能用这种方式链接过滤器。

最简单的方法是编写一个可以顺序调用的包装器(至少通过shell脚本中的管道)。
(如“Is it possible to redirect output of one program to input of other program in different operational systems?”)。