git push to all remotes 1

git push to all remotes

#To push all branches to all remotes:
git remote | xargs -L1 git push --all

#Or if you want to push a specific branch to all remotes:
#Replace master with the branch you want to push.
git remote | xargs -L1 -I R git push R master

#(Bonus) To make a git alias for the command:
git config --global alias.pushall '!git remote | xargs -L1 git push --all'

Here is what the above code is Doing:
1. git remote returns a list of all remotes.
2. xargs -L1 runs the command once for each line of input.
3. git push –all pushes all branches to the remote.

Similar Posts