git pull push 所有分支


  • 因为远端 git 服务器上有很多分支,一个个分支pull太麻烦,所以找了 pull 所有分支的方法,如下:

      git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
      git fetch --all
      git pull --all
    
  • 上面的操作是建立在已经配置了 ssh key 的基础上。

  • 生成 ssh key 命令如下:

    ssh-keygen -t rsa -C “xxx.com”
    
  • 先 clone 远端, 通过git协议 clone

  • 这样 git remote 会自动配置远端地址

  • 然后就可以执行上面的 git pull --all 操作。

  • git push xxx.com --all 能将所有分支push 上去。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM