Reputation: 10918
I have the following "push all" alias in my .gitconfig:
[alias]
pall = !git remote | xargs -L1 -I R git push R
This allows me to push to master on all remotes with
git pall master
With 3 remotes this gives me an output that looks like
Everything up-to-date
Everything up-to-date
Everything up-to-date
I'm looking for a way to have the command show what is actually being executed. Something like
git push remote1 master
Everything up-to-date
git push remote2 master
Everything up-to-date
git push remote3 master
Everything up-to-date
I'm not sure how to access the branch argument though. Not as simple as $1. How can I modify my alias so executing it results in an output that explains what is going on as shown above?
Upvotes: 2
Views: 220
Reputation: 18951
I think you probably need to run xargs
with -t
:
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
Upvotes: 2