How to use pull requests in Fedora Forge
Overview
Pull requests are used to review and discuss changes before they are added to the main project. They help teams collaborate, find mistakes, improve quality, and keep the project history clear and organized.
This allows you to contribute changes from your fork of a project to the upstream project. To contribute a change to a project you first open a pull request with original project. The project maintainer then merges the pull request if they are satisfied with the changes you have proposed.
Open a Pull Request
Forge to Forge pull request
When you’ve pushed changes to your fork of a project you want to contribute to, you can open a pull request:
-
Go to the
Pull requeststab in the repo you want to merge into. This page shows existing pull requests and is where you start a new one. -
Click
New pull request. If the button is not visible, check that you are in the correct repository and on the right branch. -
Select the branch to merge into (usually something like
docs:main) and the branch to pull from (your fork). Before continuing, make sure the source and target branches are the ones you actually want to compare.
This is the main page of the repo you want to merge into.
In this tab you can see all open pull requests or you can go into closed tab and look for closed PRs.
| Always double-check before continuing to make sure you don’t create a PR to or from the wrong branch. |
Use a clear title and description so reviewers understand the change. The title should briefly summarize the change, while the description can explain the details or mention anything a reviewer should know.
Title and description will be populated the last commit message, so if it’s just a small change you can just easily click Create pull request.
|
Remote Git to Forge pull request
You can create a pull request from another git hosting platform (e.g. GitHub, GitLab). This is a remote pull request.
From the pull requests list
-
Go to the main project’s (not your fork) pull requests list and press the
File Pull Requestbutton. -
Select the
Remote pull-requestoption from the dropdown menu. -
Fill the New remote pull-request form (Title, Git repo address and Git branch) and create your remote pull-request.
Congratulations! It is now up to the project maintainer to accept your changes by merging them.
Updating Your Pull Request
It is likely that project maintainers will request changes to your proposed code by commenting on your pull request. Don’t be discouraged! This is an opportunity to improve your contribution and for both reviewer and contributor to become better programmers/writers.
Adding to your pull request is as simple as pushing new commits to the branch you used to create the pull request. These will automatically be displayed in the commit list for the pull request.
Rebasing
You may encounter a situation where you want to include changes from the master branch that were made after you created your pull request. You can do this by rebase your pull request branch and pushing it to your remote fork.
To rebase your branch onto latest upstream changes, run:
git fetch upstream
git rebase upstram/main
After resolving any conflicts, run:
git push --force-with-lease origin your-branch-name
Use --force-with-lease instead of --force. It is safer because it will refuse to overwrite the remote branch if someone else has pushed changes to it in the meantime.
|
Want to help? Learn how to contribute to Fedora Docs ›