我的 .gitconfig 中有以下“push all”别名:
[alias]
pall = !git remote | xargs -L1 -I R git push R
这允许我在所有 Remote 上推送到主机
git pall master
使用 3 个 Remote ,这给我一个看起来像这样的输出
Everything up-to-date
Everything up-to-date
Everything up-to-date
我正在寻找一种方法让命令显示实际正在执行的内容。类似的东西
git push remote1 master
Everything up-to-date
git push remote2 master
Everything up-to-date
git push remote3 master
Everything up-to-date
但我不确定如何访问分支参数。不是 1 美元那么简单。如何修改我的别名,以便执行它会产生一个输出,解释正在发生的情况,如上所示?
最佳答案
我认为您可能需要使用 -t
运行 xargs
:
Echo the command to be executed to standard error immediately before it is executed.
$ seq 10 | xargs -t -I x echo "n=x"
echo n=1
n=1
echo n=2
n=2
echo n=3
n=3
echo n=4
n=4
echo n=5
n=5
echo n=6
n=6
echo n=7
n=7
echo n=8
n=8
echo n=9
n=9
echo n=10
n=10
关于bash - 使用 xargs 显示 git 别名中的命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59221455/