V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
Cu635
V2EX  ›  git

各位, git 有办法按照文件类型 ignore 么?

  •  
  •   Cu635 · 2015-10-14 19:21:32 +08:00 · 3031 次点击
    这是一个创建于 3116 天前的主题,其中的信息可能已经有所发展或是发生改变。
    用 git 的时候需要配置 gitignore ,按照文件扩展名 ignore 这是没问题的。

    有没有办法让 git 按照文件类型来 ignore ?

    类似于“先用 file 命令确定文件类型,然后再用文件类型作为参数去 ignore ”,当然具体的实现不一定用 file 命令了。
    5 条回复    2015-10-15 11:14:54 +08:00
    alexapollo
        1
    alexapollo  
       2015-10-14 19:42:36 +08:00
    FrankFang128
        2
    FrankFang128  
       2015-10-14 20:35:19 +08:00 via Android
    你不能先统一一下文件扩展名么
    Robling
        3
    Robling  
       2015-10-14 23:05:17 +08:00 via Android
    用 git 的钩子脚本动态生成 gitignore
    xiuc001
        4
    xiuc001  
       2015-10-15 10:27:22 +08:00
    可以用文件名 ignore ,但要注意的是如果你的文件已经在版本库了,即使你配置了 ignore 文件也是不生效的
    Cu635
        5
    Cu635  
    OP
       2015-10-15 11:14:54 +08:00
    @Robling 多谢。看样子这是最为接近的办法了。

    不过这样的话每次有新文件 unversioned 的话都要扫描了?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1025 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 19:35 · PVG 03:35 · LAX 12:35 · JFK 15:35
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.