Search code examples
github

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


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.


Solution

  • The trick is not to use the master branch to create pull requests. Then you won't need to create multiple forks since you can make as many branches as you need and make pull requests against each branch independently.

    Given a forked repo with a clean master (or e.g main) branch, create a dedicated branch and use that branch to make your pull request.

    If you prefer, you can also create branches directly from the web UI (although it might not be obvious).

    Click the branch selection dropdown, type the new branch name in the input field, and then you'll see a clickable link Create branch: <new-branch-name> as shown below. The tricky UI part is that it might not be obvious you should click the "create branch: xyz..." — it is NOT displayed as a button or as a hyperlink, and it's not obvious that this is a clickable link. Anyone probably assumes that the search box is for searching branches, and not for creating them. Given that it appears as a search field people would probably ignore the placeholder which says 🔍 Find or create a branch... purely because of visual cognitive dissonance.

    github web create branch

    In case you already made changes directly in your fork's master branch then consider moving those changes to a dedicated branch (e.g. git checkout -b bugfix42) and then hard resetting the master branch to the original remote so that you can keep it clean for synching with the upstream repo.

    See also: