开发者

switching remotes in github

开发者 https://www.devze.com 2023-03-17 13:39 出处:网络
Can we switch to different remotes in githubI have two remotes upstream (main repo) origin (mywork) Accidently, i created clone of upstream and created branches and worked in it. I want to miove all

Can we switch to different remotes in github I have two remotes

upstream (main repo) origin (mywork)

Accidently, i created clone of upstream and created branches and worked in it. I want to miove all changes ma开发者_如何学Gode to upstream's test branch to origin and also switch to origin. Now when ever I create a branch it is created in origin

Please suggest.


Considering those are the same repo (or at least repos with a common history), you can:

  • clone the other GitHub repo 'origin' 'mywork'on your computer
  • add the first repo (the 'upstream' cloned one locally) as a remote (git add remote upstream file:///path/to/main/repo)
  • fetch everything and create local branches out of the remote branches
  • push everything back to your origin 'mywork' repo
0

精彩评论

暂无评论...
验证码 换一张
取 消