Able to push to all git remotes with the one command?

前端 未结 6 1491
广开言路
广开言路 2020-11-30 16:10

Instead of doing:

git push origin --all && git push nodester --all && git push duostack --all

Is there a way to do that wit

6条回答
  •  無奈伤痛
    2020-11-30 16:31

    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'
    

    Running git pushall will now push all branches to all remotes.

提交回复
热议问题