簡體   English   中英

從本地分支推送到另一個遠程分支

[英]push from local branch to different remote branch

我在遠程有2個分支,分別名為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

developer分支上時,嘗試git push -u origin Current -u是簡寫--set-upstream 看起來--set-upstreamgit branch要求上游分支已經存在; git push一起使用時不是這種情況。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM