[英]How to move branch from one repository to another branch of different repository
I created a new Repository (named repoN) with the existing one (named repoE), simply by copying code from the branch (named B22).我使用现有的存储库(命名为 repoE)创建了一个新的存储库(命名为 repoN),只需从分支(命名为 B22)复制代码即可。
After that, I created a new branch in repoN (named BR01).之后,我在 repoN 中创建了一个新分支(名为 BR01)。 Now I made some changes in the branch (named BR01) which exist in repoN repository.
现在我在 repoN 存储库中存在的分支(名为 BR01)中进行了一些更改。
I just want to take all those changes into the old repository repoE without loosing history of BR01 into B22.我只想将所有这些更改放入旧存储库 repoE 中,而不会丢失 BR01 到 B22 的历史记录。
I am using SourceTree because I'm new in Git and don't know much commands.我使用 SourceTree 是因为我是 Git 新手并且不知道很多命令。
git remote add repoRemote https://bitbucket/repo/repo1.git
git push repoRemote
-- will push your current branch to the remote repo you added in #3 git push repoRemote
-- 将你当前的分支git push repoRemote
你在 #3 中添加的远程git push repoRemote
At first you need to add to git your destination repository, lets call it repoE
( set remote tracking )首先,您需要将目标存储库添加到 git 中,我们称之为
repoE
(设置远程跟踪)
git remote set-url repoE https://github.com/USERNAME/repoE.git
then switch to branch your want to push, assume your branch called BR01
然后切换到您想要推送的分支,假设您的分支名为
BR01
git checkout BR01
and push this branch to destination repository并将此分支推送到目标存储库
git push repoE BR01
在 SourceTree 中,可以通过将 repoE 添加到 Repository->Add Remote 来完成,以便您可以将 repoN 中的更改推送到该 repo。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.