从远程分支推送到其他远程分支

时间:2020-02-06 10:31:03

标签: git git-branch git-push git-refspec

如果我想将内容从remote:master推送到同一远程但不同的分支,该怎么办?

借助git push remote.git master:mybranch,我可以将本地存储库推入第二个分支

但是我想要的不是来自本地而是来自远程

所以remote:master -> remote:branch

像这样吗?

git push remote.git 'refs/remotes/master:refs/remotes/mybranch'
git push remote.git 'refs/heads/master:refs/heads/mybranch'

1 个答案:

答案 0 :(得分:1)

您必须将实际的master拖入本地分支(可以将其转移到新分支),然后推送到远程。