How do I change which GitHub project I was branching from?

I forked the project, made some changes, and received an accepted transfer request. But now the project that I forked has moved to another repository and is the fork of this repository.

I.e:

Original -> MyFork 

Now:

 NewOriginal -> Original -> MyFork 

How do I get the following:

 NewOriginal -> MyFork 
+65
git github fork
Apr 21 2018-11-21T00:
source share
4 answers

Locally, you can simply change the target of the original repository. Usually this repository is called upstream, so you should do this:

 git remote set-url upstream git://example.com/NewOriginal.git 

Depending on which host you are using (that is, where your plug is located), there may be some additional internal links, you cannot change so easily. For example, in Github, the fork is directly connected to the original from which you are bifurcated. In this case, you need to open a new project again and work with the new plug.

In this case, however, you can easily change the URL of the original repository, as well as just click everything that you changed earlier in the old fork into your new fork.

+48
Apr 21 '11 at 20:15
source share

NOTE The following solution is incomplete, as you will lose all wiki content and problems specific to your plug.

You can achieve this by following these steps:

  • Pull all branches and tags from an existing fork.
  • Delete repository on GitHub.
  • Fork from the new repository.
  • Update the remote URL if necessary.
  • Paste all local branches and tags into the new repository.
+54
Jun 28 '13 at 14:17
source share

Update the remote URL in your repository:

 git remote set-url origin <url to NewOriginal, eg git://…/bla.git> 
+9
Apr 21 2018-11-21T00:
source share

Assuming you've correctly forked and added upstream, see githubHelpOnFork ; to simply change the URL upstream, do:

  • check what the current stream and origin looks like:

     git remote -v 
  • if you see the upstream and you just want to change its url do what @poke suggested (if you don't follow the helpGithub link above to add a new upstream):

     git remote set-url upstream git://example.com/NewOriginal.git 
  • then make sure that upstream points to the new URL

    git remote -v

+2
Jan 30 '16 at 13:04 on
source share



All Articles