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.
How can I do that 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.
How can I do that on GitHub?
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.
git clone --bare https://github.com/Your/<Forked Repository>.git
cd <Forked Repository>/
git push --mirror
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:
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.
This solution maintains everything in the original repository including the commit history, branches, and more.
Also this doesn't require you to delete the original repository before pushing the new one, so you won't lose anything if your computer goes wrong :)
If you look in the settings of your GitHub project, there is a section:
Following the link for 'duplicate the repository', we get here, where it tells us what to do.
I'm writing the steps here, but there are some more options you can check out on that page.
To duplicate a repository without forking it, you can run a special clone command, then mirror-push to the new repository.
Create another repository for the new duplicate repository.
$ git clone --bare https://github.com/exampleuser/old-repository.git
$ cd old-repository.git
$ git push --mirror https://github.com/exampleuser/new-repository.git
$ cd ..
$ rm -rf old-repository.git
And that's it! Now you can delete your original repository (although I recommend just appending old-
and updating the README and description), and make sure to remember to re-clone the right repository!
If you want to keep the original name, just rename it when you're done.
You'll creating a PR from a fork using the browser, the upstream repository will always be the default base when creating a PR from a fork. To change this behaviour you'd have use a browser add-on to change the Compare page URL.
https://github.com/<OWNER>/<BASE REPO>/compare/<BRANCH>...<FORK REPO>:<BRANCH>
https://github.com/<YOUR>/<FORK REPO>/compare/<BRANCH>...<FORK REPO>:<BRANCH>