简体   繁体   English

将本地新的Git存储库作为分支推送到现有的远程存储库?

[英]Push local new Git repo to existing remote repo as branch?

I have a situation where I completely re-wrote the code from scratch where we had current existing code on the remote repo. 我遇到的情况是,我从头开始完全重写了代码,而远程回购中已有最新的代码。

I would like to push my local new repo master to that existing remote as a branch to merge it later upon review. 我想将我的本地新存储库主服务器推送到该现有远程服务器,作为分支,以便稍后进行审核时将其合并。

Remote git repo: A has branches a1, a2, a3 远程git repo:A具有分支a1,a2,a3

My local new repo: B 我的本地新仓库:B

After my desired push to remote: A has branches a1, a2, a3, and ab 在我希望推送到远程之后:A具有分支a1,a2,a3和ab

Is it even possible? 可能吗

Thank you. 谢谢。

Sure. 当然。 Just push it like this: 像这样推动它:

git push origin master:ab

This will push your local master branch to ab branch of the remote named origin . 这会将您的本地master分支推送到远程命名origin ab分支。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM