2

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 made 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.

DotnetSparrow
  • 27,428
  • 62
  • 183
  • 316

1 Answers1

0

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
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250