【问题标题】:Hide listing of certain files/directories after git pull?git pull 后隐藏某些文件/目录的列表?
【发布时间】:2012-05-03 02:16:24
【问题描述】:

通常当我从项目中提取时,会有部分或文件对我的工作没有影响,只会让我的终端窗口膨胀:

计数对象:100,完成。 远程:压缩对象:100% (2/2),完成。 远程:总共 3 个(增量 29),重复使用 72 个(增量 19) 拆包对象:100% (3/3),完成。 来自 github.com:Foo/bar * 分支主 -> FETCH_HEAD 通过递归进行合并。 /js/i_care_about_this_file.js | 2 +- /php/i_care_about_this_also.php | 4 +- /flash/some_project/file_i_dont_care_about.swf | Bin 0 -> 904 字节 46 个文件更改,22 个插入(+),64 个删除(-) 创建模式 100188 /flash/some_project/file_i_dont_care_about.swf

显然,这是一个非常简短的示例 — 通常有数百个 SWF 文件,我不想在拉取时显示出来。

有没有可以传递给git pullgit merge 的标志?或者我可以在 git 或我的 shell 中设置一些配置参数?

【问题讨论】:

    标签: git shell terminal


    【解决方案1】:

    显然 git 不知道你关心什么和不关心什么,但你可以通过 --quiet 让它完全闭嘴。

    此外,git 并非真正设计用于处理 SWF 等二进制文件。你为什么要检查他们?

    【讨论】:

    • 此外,git 旨在处理文件中的差异,而.swfs 只是另一种类型的文件。失败的是.swfs 的二进制性质使更改看起来像 90% 以上的文件已更改,因此每次更改 git 一次又一次地存储几乎整个文件,这从根本上增加了存储库的大小。
    【解决方案2】:

    您可以使用-q 开关:

            -q, --quiet
           This is passed to both underlying git-fetch to squelch reporting of during transfer, and underlying git-merge to squelch output during
           merging.
    

    或者我猜你想要更多-n

       --stat, -n, --no-stat
           Show a diffstat at the end of the merge. The diffstat is also controlled by the configuration option merge.stat.
    
           With -n or --no-stat do not show a diffstat at the end of the merge.
    

    您是否只想隐藏.swf 文件我猜您必须将git pull 输出传送到sedgrep,例如:

    $ git pull <remote> | grep -v ".swf "
    

    【讨论】:

      猜你喜欢
      • 2019-10-09
      • 2021-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-21
      • 2010-09-28
      • 2017-04-11
      相关资源
      最近更新 更多