Creating a pull request (PR) to make edits on a project hosted on GitHub doesn’t always have to involve contributing code. In fact, even non-developers can participate by simply editing a file, such as a project’s README to fix a typo. By learning how to create pull requests, you can not only collaborate with others on projects but also gain the confidence to contribute code in the future.
Assuming you already have a free GitHub account, let me walk you through the process. Here’s an example:
-
Identify the file you want to edit on GitHub. In this case, I found a possible typo in an article on the web.dev website.
- Article to be edited: https://web.dev/prefers-color-scheme/
- GitHub repository for the article: https://github.com/GoogleChrome/web.dev/tree/master/src/site/content/en/blog/prefers-color-scheme
-
Open the index.md file directly on GitHub and click the pencil icon in the file toolbar. This allows you to edit the file.
-
A new view will open displaying the editor. Here, you can make your desired changes.
- Information displayed:
You’re editing a file in a project you don’t have write access to. Submitting a change to this file will write it to a new branch in your fork flaviocopes/web.dev, so you can send a pull request.
- Information displayed:
-
After making the necessary changes, scroll down to the form at the bottom and provide a clear explanation of the changes you made.
-
Click the “Propose File Change” button, and a compare view will appear. Review the changes you made to ensure everything looks good.
-
Finally, click the “Create Pull Request” button. This will create a pull request in your forked version of the project, which GitHub automatically created when you clicked the pencil icon.
-
On the pull request view, you will see the details of the pull request you’re about to submit. Additionally, you can write a detailed description of the changes you made.
-
If necessary, you can add a summary to the pull request to better manage changes.
-
At this point, you may need to sign a Contributor License Agreement (CLA) to complete the pull request. Follow the provided instructions if this step applies to you.
-
Once you’ve completed the necessary steps, click “Create pull request” to submit your pull request.
Now, it’s up to the project maintainers to review and potentially accept your changes. You’ll receive an email notification when your pull request is merged or if there are any comments or modifications requested.
Remember, if your pull request is not accepted, don’t get discouraged. Project maintainers are knowledgeable about their projects and might have different views on what is best. It’s also a good idea to check with the project maintainers before working on a substantial pull request to ensure it aligns with their needs.
[tags: GitHub, pull request, editing files, collaboration]