且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将分支从一个存储库移动到另一个存储库的另一个分支

更新时间:2023-01-04 21:44:05

首先,您需要添加您的存储库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