简体   繁体   English

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

[英]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 新手并且不知道很多命令。

  1. stand on your current repo you want to push from站在你想要推送的当前仓库上
  2. checkout the branch you want to push结帐您要推送的分支
  3. git remote add repoRemote https://bitbucket/repo/repo1.git
  4. 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.

相关问题 Git:将特定文件从一个存储库中的一个分支移动到另一个存储库中的另一个分支 - Git: Move specific files from one branch in one repository to another branch in another repository 如何将目录从一个存储库推送到另一个存储库的主分支? - How to push a directory from one repository to the master branch of another repository? 将现有分支从一个存储库合并到新存储库的另一分支 - Merging an existing branch from one repository to another branch of a new repository 如何将一个存储库的分支推送到另一个存储库中的新分支? - How to Push branch of one repository to a new branch in another repository? 如何将存储库中的分支添加到另一个存储库的分支 - How to add a branch from the repository to the branch of another repository GIT 如何将更改从一个存储库的分支拉到另一个存储库的分支 - GIT how to pull changes from a branch in one repository into a branch of another repository 将GitHub存储库移到另一个存储库的分支中 - Move GitHub repository into a branch of another repository 如何将分支从一个GitHub存储库复制到另一个? - How to copy a branch from one GitHub repository to another? 将gh-pages分支从一个存储库复制到另一个存储库 - Copying gh-pages branch from one repository to another repository 一个存储库中的Git master分支,另一个私有存储库中的另一个分支 - Git master branch in one repository and another branch on another private repository
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM