如何缩短'git pull'命令的输出?

bxq*_*bxq 1 git github git-pull

  • 所以我在$ git pullgit存储库上运行命令.
  • 它输出了我感兴趣的有用细节,以及我不关心的许多其他细节.
  • 那么是否有一些开关或选项只留下我需要的细节?

$ git pull

需要这个信息:

remote: Enumerating objects: 2866, done.
remote: Counting objects: 100% (2866/2866), done.
remote: Total 4840 (delta 2865), reused 2865 (delta 2865), pack-reused 1974
Receiving objects: 100% (4840/4840), 7.51 MiB | 2.98 MiB/s, done.
Resolving deltas: 100% (3810/3810), completed with 531 local objects.
From https://github.com/erlang/otp
   76da23bb4e..6053c0e4d7  master     -> origin/master
   77cff66931..39968f062e  maint      -> origin/maint
   934f9974eb..f30b1052c7  maint-21   -> origin/maint-21
 * [new tag]               OTP-21.2.6 -> OTP-21.2.6
 * [new tag]               OTP-20.3.2.1 -> OTP-20.3.2.1
Updating 76da23bb4e..6053c0e4d7
Run Code Online (Sandbox Code Playgroud)

不需要这些信息:

Fast-forward
 .gitignore                                         |     3 +
 bootstrap/bin/no_dot_erlang.boot                   |   Bin 6539 -> 6541 bytes
 bootstrap/bin/start.boot                           |   Bin 6539 -> 6541 bytes
 bootstrap/bin/start_clean.boot                     |   Bin 6539 -> 6541 bytes
 bootstrap/lib/compiler/ebin/beam_a.beam            |   Bin 3364 -> 3200 bytes
 bootstrap/lib/compiler/ebin/beam_asm.beam          |   Bin 11040 -> 10996 bytes
 bootstrap/lib/compiler/ebin/beam_block.beam        |   Bin 3460 -> 3444 bytes
 bootstrap/lib/compiler/ebin/beam_disasm.beam       |   Bin 20864 -> 20860 bytes
 bootstrap/lib/compiler/ebin/beam_except.beam       |   Bin 4252 -> 4228 bytes
 bootstrap/lib/compiler/ebin/beam_jump.beam         |   Bin 10024 -> 9988 bytes
 .../lib/compiler/ebin/beam_kernel_to_ssa.beam      |   Bin 29484 -> 28880 bytes
 bootstrap/lib/compiler/ebin/beam_peep.beam         |   Bin 3644 -> 3604 bytes
 bootstrap/lib/compiler/ebin/beam_ssa.beam          |   Bin 12208 -> 12176 bytes
 bootstrap/lib/compiler/ebin/beam_ssa_bsm.beam      |   Bin 18176 -> 17952 bytes
 bootstrap/lib/compiler/ebin/beam_ssa_codegen.beam  |   Bin 37824 -> 37708 bytes
 bootstrap/lib/compiler/ebin/beam_ssa_dead.beam     |   Bin 12128 -> 11876 bytes
 bootstrap/lib/compiler/ebin/beam_ssa_lint.beam     |   Bin 7512 -> 7536 bytes
 etc...
Run Code Online (Sandbox Code Playgroud)

那我该怎么做?

Rom*_*eri 5

提醒一下,git pull命令实际上是git fetch跟随给定(或已解决)远程跟踪分支的合并.

对你有用的第一部分是"fetch"部分的输出git pull.第二部分,你想要的,是随后的快进合并的输出.

您可以拆分操作,以便仅静音第二部分:

git fetch
git pull -q
Run Code Online (Sandbox Code Playgroud)

想减少打字?别名

git config --global alias.qpull '!git fetch && git pull -q'
Run Code Online (Sandbox Code Playgroud)

然后就做

git qpull origin <someBranch>  # for "quiet pull" for example but anything goes of course
Run Code Online (Sandbox Code Playgroud)