Merge the Pull Request into the Repository of the Fork

github-readme-stats is a GitHub profile statistics generator that allows users to display various statistics and charts within their GitHub profiles. It offers multiple customization options to tailor it to user needs.

I manage my repository habits by grouping them by project; GitHub doesn’t support repository grouping, so I have to achieve this by splitting repositories across different organizations. The latest branch of github-readme-stats cannot support statistics for repositories spanning different organizations; I forked a branch and merged the corresponding code.

Final Result

GitHub Stats Top Languages

Pull Request Original Address

Adds the ability to include data from organization repositories

Merging a Pull Request into Your Forked Repository

To merge a Pull Request (PR) into your forked repository, there are several ways to do this, depending on whether you want to:

  1. Merge the PR from the upstream repository into your fork, or
  2. Merge a PR from another person’s fork into your fork, or
  3. Merge a PR that was opened on your fork (e.g., someone forked and created a PR for you)

I’ll first give you a common scenario: You have forked a repository and want to merge a PR from the upstream into your fork. Here’s the workflow below 👇

✅ Method One: Command Line (Most Universal)

Step 1: Clone your own fork

git clone https://github.com/your-username/repository-name.git
cd repository-name

Step 2: Add Upstream (Original Repository Address)

git remote add upstream https://github.com/original-author-username/repository-name.git

Step 3: Fetch the Upstream PR Branch

Find the PR number you want to merge, for example PR #123. You can then checkout the code for that PR like this:

git fetch upstream pull/123/head:pr-123

Step 4: Switch and Merge Branches

git checkout main    # Or your own target branch
git merge pr-123

If everything goes well, you can push to your forked GitHub repository:

git push origin main

✅ Method Two: GitHub Web Interface (Simple but Limited)

If you see a PR on GitHub’s web interface that is against the upstream repository, you can:

  1. Navigate to the PR page.
  2. Click “Commits” or “Files changed” in the top-right corner to see which branch this PR is based on.
  3. On your fork page, create a new branch and then manually cherry-pick the PR’s commit (requires Git knowledge).
  4. Or, click “Open in GitHub Desktop” and use the GUI tool to merge.

🚀 If someone has created a fork and submitted a PR to it, simply navigate to the PR page, click the “Merge pull request” button, and you’re done.


Would you like me to walk you through it step-by-step based on your specific scenario (e.g., PR link, whether you’re using a web interface or the command line)? Or, please provide the link and I can analyze the simplest approach for you.

Licensed under CC BY-NC-SA 4.0
Last updated on Jun 02, 2025 20:54
A financial IT programmer's tinkering and daily life musings
Built with Hugo
Theme Stack designed by Jimmy