Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make a second fork of a GitHub project?

Tags:

github

I want to fork a github project to fix a couple of issues and then send a pull request.

The problem I'm running into is that I've already forked the project to adapt it for another user base.

Is it possible to create a second fork? If so, how?

When I try to fork now it just takes me to the previously created fork.

like image 302
pixelfairy Avatar asked Jan 23 '15 22:01

pixelfairy


People also ask

Can I create multiple forks GitHub?

It's not possible to create two forks of the same repository in the same user account, no. Although, it's rarely necessary to do so since if you need to keep two different repository states around, you can always use git branches.

How do I fork a GitHub repository twice?

You are unable to fork a repo twice on Github (as of late 2021) but if you want to build on the same repo multiple times, you can use the "Import Repository" option and feed it the URL used to clone.

How do I add a fork to GitHub?

To follow along, browse to a public repository that you want to fork. At the top right of the page, you will find the Fork button. Click on the button and wait for a few seconds. You will see that the newly forked repository gets created under your GitHub account.

How do you add a fork to a repository?

You can fork any repo by clicking the fork button in the upper right hand corner of a repo page. Click on the Fork button to fork any repo on github.com. Source: GitHub Guides.


2 Answers

There is no way to have two forks of the same GitHub project unless you use two different GitHub accounts.

So:

  1. Create a separate GitHub account (and verify the email)

  2. Fork the project

  3. Invite your main GitHub account as a "Collaborator" (from the settings)

You may need to add the extra step of creating an organization with the new GitHub account and inviting your main github account as an owner of the organization (also make sure your new fork is in that new organization). This will let you do things like deploy automatically to a Heroku app that is connected to your main GitHub account.

Why can't we just have multiple forks???

like image 56
pixelfairy Avatar answered Sep 30 '22 01:09

pixelfairy


I mean that I could just commit and push without making a pull request, but I want to do it the offical way and I want somebody else to review the changes before I push to a public project.

GitHub pull requests do not need to be submitted from a fork; they work within a single repository as well:

Pull requests are especially useful in the fork & pull model because they provide a way to notify project maintainers about changes in your fork. However, they're also useful in the shared repository model where they're used to initiate code review and general discussion about a set of changes before being merged into a mainline branch.

There's nothing stopping you from creating a pull request even if you don't technically have to. This is often considered a best practice, and GitHub's own Flow model is largely based on pull requests.

Creating a pull request within a single repository is very similar to creating one from a fork:

  1. Create a feature branch and push your work to that branch on GitHub
  2. In the GitHub web UI, switch to your feature branch
  3. Click the "Compare" & review button
like image 28
Chris Avatar answered Sep 30 '22 02:09

Chris