git branch

随声附和 提交于 2019-12-01 07:46:54

Git push branch from one remote to another?

A quick test making some temporary repositories shows you can construct a refspec that can do this:

$ git push rorg origin/one:refs/heads/one
Counting objects: 5, done.
Writing objects: 100% (3/3), 240 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /tmp/rorg
 * [new branch]      origin/one -> one

So origin/BRANCHNAME:refs/heads/BRANCHNAME

Checking in my rorg remote:

  • Clone一个本地干净的库 或者 使用你本地的一个库
  • 命令行新增一个remote 叫azure
    • git remote add azure url
  • 将remote/origin中的所有分支全部推到azure中
    • git push azure refs/remotes/origin/*:refs/heads/*   //make sure the previous remote name is origin
  • 使用同样的方法将tags都推到azure中
    • git push azure refs/tags/*:refs/tags/*

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!