Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change base fork on GitHub?

I've forked a repo to create a new project. The new project is now indipendent and I want to change the base fork to the head fork when creating PRs by default, in order to avoid mistakes.

enter image description here

How can I do that on GitHub?

like image 975
napolux Avatar asked Aug 04 '17 06:08

napolux


People also ask

Can I edit a fork on GitHub com?

When you fork a project in order to propose changes to the original repository, you can configure Git to pull changes from the original, or upstream, repository into the local clone of your fork. On GitHub.com, navigate to the octocat/Spoon-Knife repository.


2 Answers

If you want to make the project your own, there are two ways to do it.

The right way:

Contact github support. This is the right way and the best way as they usually reply within hours. (Check out forks for information about forks)

The not so right way:

Create a new repository and add contents from the forked repository.

  • Step 1: git clone --bare https://github.com/Your/<Forked Repository>.git
  • Step 2: Goto your github account and delete the forked repository.
  • Step 3: Create a new repository with the same name
  • Step 4: cd <Forked Repository>/
  • Step 5: git push --mirror
like image 159
Adithya Bhat Avatar answered Oct 02 '22 20:10

Adithya Bhat


If you want to "disassociate" your fork from the original upstream repository, so that (a) it no longer shows up as a "fork" of the upstream project and (b) pull requests will by default be against your own master rather than the upstream master, you can:

  1. Ensure you have a complete copy of the repository locally.
  2. Delete the project on github.
  3. Re-create the project on github with the same name.
  4. Push your local repository to github.

And that's it. You will no longer have the option of submitting pull requests against the upstream project, but maybe that's what you want. An alternative to the above steps would be to simply create a project with a new name, and push your code there. Leaving your forked project in place would preserve your ability to submit PRs upstream if you need to do that at some point in the future.

like image 39
larsks Avatar answered Oct 02 '22 20:10

larsks