git pull之后隐藏某些文件/目录的列表?

时间:2012-04-22 00:02:01

标签: git shell terminal

通常,当我从一个项目中拉出来时,会有一些部分或文件对我的工作没有影响,只是膨胀我的终端窗口:

Counting objects: 100, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 29), reused 72 (delta 19)
Unpacking objects: 100% (3/3), done.
From github.com:Foo/bar
 * branch            master     -> FETCH_HEAD
Merge made by recursive.
/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 bytes
46 files changed, 22 insertions(+), 64 deletions(-)
create mode 100188 /flash/some_project/file_i_dont_care_about.swf

显然这是一个非常简短的例子 - 当我拉动时,通常会有数百个SWF文件显示出来。

我可以传递给git pullgit merge的旗帜吗?或者我可以在git或my shell中设置一些配置参数?

2 个答案:

答案 0 :(得分:1)

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

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

答案 1 :(得分:1)

您可以使用-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 "