将代码从存储库的一个分支推送到另一个存储库的另一个分支 [英] Pushing code from one branch of a repo to another branch of another repo

查看:49
本文介绍了将代码从存储库的一个分支推送到另一个存储库的另一个分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个回购说ABC/A.我已经将此仓库分叉到我自己的github上,说是ME/A.我被要求在ME/A说x上创建一个分支(最初是开发和掌握).我必须编写一些代码,因此我克隆了ABC/A并致力于其development分支.但是现在当我不得不推送代码时,由于我无权这样做,所以我无法将其推送到ABC/A.我必须将代码推送到ME/A.问题是,我在ABC/A的开发分支上工作,但是我必须将代码推送到ME/A x分支.可以通过这种方式推送代码吗?

There is a repo say ABC/A. I had forked this repo to my own github say ME/A. I was asked to create a branch on ME/A say x (originally there were develop and master). I had to write some code, so I cloned ABC/A and worked on its develop branch. But now when I have to push the code, I cannot push it to ABC/A as i dont have rights to do so. I have to push the code to ME/A. The problem is, I worked on develop branch for ABC/A but I have to push the code to ME/A x branch. Is it possible to push code in such a way?

推荐答案

是的,您可以将任何本地分支推送到任何远程分支.语法是

Yes, you can push any local branch to any remote branch. The syntax is

git push <remote name, e.g. origin> <local branch name>:<remote branch name>

如果当前分支(要推送的分支)名为develop,则命令为

If your current branch (the one you want to push) is called develop, the command would be

git push ME develop:x

这篇关于将代码从存储库的一个分支推送到另一个存储库的另一个分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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