pull/push from multiple remote locations

后端 未结 15 1243
傲寒
傲寒 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:47

    I added these aliases to my ~/.bashrc:

    alias pushall='for i in `git remote`; do git push $i; done;'
    alias pullall='for i in `git remote`; do git pull $i; done;'
    
    0 讨论(0)
  • 2020-11-21 10:48

    You can add remotes with:

    git remote add a urla
    git remote add b urlb
    

    Then to update all the repos do:

    git remote update
    
    0 讨论(0)
  • 2020-11-21 10:50

    Here is my example with bash script inside .gitconfig alias section

    [alias]
            pushall = "!f(){ for i in `git remote`; do git push $i; done; };f"
    
    0 讨论(0)
提交回复
热议问题