如何将分支从一个存储库移动到另一个存储库的另一个分支 [英] How to move branch from one repository to another branch of different repository

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

问题描述

我创建了一个新的存储库(名为repoN)与现有的存储库(名为repoE),只需从分支中复制代码(名为B22)。

,我在repoN中创建了一个新分支(名为BR01)。
现在我对存储在repoN存储库中的分支(名为BR01)进行了一些更改。



我只想将所有这些更改带入旧存储库repoE而不会将BR01的历史丢失到B22中。



我使用SourceTree是因为我是Git中的新手而且不知道太多的命令。

解决方案

首先,您需要添加您的存储库repoE(设置远程跟踪)

  git remote set-url repoE https://github.com/USERNAME/repoE.git 



然后切换到你要推送的分支

  git checkout BR01 

并将分支本身推送到另一个存储库

  git push repoE BR01 


I created a new Repository (named repoN) with the existing one (named repoE), simply by copying code from the branch (named B22).

After that, I created a new branch in repoN (named BR01). Now I made some changes in the branch (named BR01) which exist in repoN repository.

I just want to take all those changes into the old repository repoE without loosing history of BR01 into B22.

I am using SourceTree because I'm new in Git and don't know much commands.

解决方案

At first you need to add you repository repoE ( set remote tracking )

git remote set-url repoE https://github.com/USERNAME/repoE.git

then switch to branch your want to push

git checkout BR01

and push branch itself to another repository

git push repoE BR01

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

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