pull/push from multiple remote locations

后端 未结 15 1246
傲寒
傲寒 2020-11-21 10:17

The short: is there a way to have a git repo push to and pull from a list of remote repos (rather than a single \"origin\")?

The long:

15条回答
  •  独厮守ぢ
    2020-11-21 10:30

    Adding the all remote gets a bit tedious as you have to setup on each machine that you use.

    Also, the bash and git aliases provided all assume that you have will push to all remotes. (Ex: I have a fork of sshag that I maintain on GitHub and GitLab. I have the upstream remote added, but I don't have permission to push to it.)

    Here is a git alias that only pushes to remotes with a push URL that includes @.

    psall    = "!f() { \
        for R in $(git remote -v | awk '/@.*push/ { print $1 }'); do \
        git push $R $1; \
        done \
        }; f"
    

提交回复
热议问题