从本地分支推送到不同的远程分支 [英] push from local branch to different remote branch

查看:17
本文介绍了从本地分支推送到不同的远程分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Remote上有两个名为developerCurrent的分支。在本地,我处理分支developer,并将我的更改推送到远程developer。问题是,如何从本地developer推送到远程Current

我尝试过这些:

git push origin Current -f
// error:
// src refspec Current does not match any.
// failed to push some refs to ...

// and this one too:
git config push.default upstream
git push origin Current -f
// error: same as the first try

// and this one too:
git branch --set-upstream-to developer origin/Current
// or:
git branch --set-upstream-to developer Current
// error: fatal: branch 'Current' (or 'origin/Current') does not exist

推荐答案

您可以:

git push origin developer:current
这将把分支developer从您的本地存储库推送到远程存储库上的分支current。如果要覆盖对分支电流所做的更改,还需要使用-f标志。

FWIW,执行git push origin :current(请注意current之前的:)将从远程删除分支current

这篇关于从本地分支推送到不同的远程分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆