![](/img/trans.png)
[英]git push command for pushing a local commit to a different remote branch
[英]git push commit to different branch
對不起,這可能是一個愚蠢的問題,但我無法弄清楚問題。
我通過git(bitbucket)克隆了一個分支,更改了一些文件,提交了這些文件並將它們推回到遠程源。
現在我想將此提交推送到另一個分支,該分支部分位於當前分支的前面和后面。 所以我嘗試了: git push origin HEAD:differentBranch
,但這不起作用(“更新被拒絕,因為推送的分支提示在其遠程對應的后面”)。
我怎樣才能解決這個問題? 再次抱歉,我的git技能仍然可以開發。
你可以使用git cherry pick來做到這一點。 所以你可以嘗試這樣:
git checkout differentBranch
git cherry-pick <commit # from previous commit from your first branch>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.