GitHub Pull Request without fork

GitHub only allows a user to have one fork derived from a repo. For maintainers of popular repos, this can be an issue as there may be many forks and forks of forks etc. To collaborate with an active contributor who is not a member of the original repo, there arises an issue since the maintainer can’t fork the contributor repo since the maintainer probably already has a fork of the original repo.

A technique we use for this is to create a branch in the original repo and then create a pull request from the contributor’s fork to the branch in the original repo (or vice versa for the pull request). That is, if the maintainer wants to make a pull request to the contributor repo, the maintainer creates a branch in the original repo and then creates a pull request from that branch to the forked repo.

Example workflow

From the original local repo, add the contributor’s fork as a remote.

git remote add contrib1 https://github.invalid/contrib1/repo.git

Fetch the contributor’s fork.

git fetch contrib1

Create a local branch tracking the contributor’s remote branch.

git switch -c contrib1-feat1 --track contrib1/feat1

Make changes, commit, and push

git push -u origin contrib1-feat1

You may need to manually compose the URL for the pull request. For this example, it would be like: