How to move branch from one repository to another branch of different repository

你离开我真会死。 提交于 2019-12-10 10:18:09

问题


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.


回答1:


At first you need to add to git your destination repository, lets call it repoE ( set remote tracking )

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

then switch to branch your want to push, assume your branch called BR01

git checkout BR01

and push this branch to destination repository

git push repoE BR01



回答2:


  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


来源:https://stackoverflow.com/questions/38118520/how-to-move-branch-from-one-repository-to-another-branch-of-different-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!