How to make the first pull request on GitHub

How to create a PR to edit a project on GitHub?

There are many tutorials on the subject, but they make things too complicated by assuming that contributions must be made.CodeTo a project. So allGitSet up before that.

What if you only need to edit the file, maybe the project README to resolve typing errors?

You don't need to know how to code or how to use Git to do this. However, once you start executing the "pull request", you can do more and collaborate with others on projects! Maybe this will prompt you to contribute code in the future.

I assume you already have one (free)GitHubaccount. If you don’t, go togithub.comAnd get one.

Let me tell you the process.

I went to this pagehttps://web.dev/prefers-color-scheme/I found a possible typo. A point is missing at the end of this line.

The article I want to edit

I am not a grammatical Nazi, this is just to find an example 😄

I know that the website is hosted on GitHub, and the exact article is hosted here:https://github.com/GoogleChrome/web.dev/tree/master/src/site/content/en/blog/prefers-color-scheme

The github folder of the article

I open the index.md filehttps://github.com/GoogleChrome/web.dev/blob/master/src/site/content/en/blog/prefers-color-scheme/index.mdDirectly on GitHub and press the pencil icon in the file toolbar. When hovering over it says: "Fork this project and edit the file".

The index.md file

This will display the editor view of the following information:

You are editing a file in a project that does not have write permissions. Committing changes to this file will write it to a new branch in the branch flaviocopes/web.dev, so you can send a pull request.

The editor view

I can add this point and then explain the changes made in the form at the bottom:

Propose file change

I press the "Suggest file changes" button and a comparison view is displayed.

Compare view

Here, I can review the changes made to make sure everything is fine, and finally, I can click the "Create pull request" button. Has beenYour forkThe project, which was automatically created by GitHub when you clicked the pencil icon.

Open pull request

At the top of this view, you can see that I am about to submit a PR to PRGoogleChrome/web.devItems in my formflaviocopes/web.devFrom my branchpatch-2give themmasterBranch.

Pressing the "Create Request Request" button will display another form in which I can write a detailed description of the request.

A pull request can contain many different changes, so in theory, you can edit many files in the same PR, which is why you can add a summary.

The repository has templates for PR texts to help the team manage it. Our PR is very simple, so I deleted the template and only pasted the content from the previous submission message.

Pay attention to the prompt on the right? They told me that the project has a CONTRIBUTING.md file, which explains how to contribute and guidelines. Pretty cool

Contributing

It seems that we need to sign a CLA (Contributor License Agreement) to complete the PR. In the past, I have signed a Google CLA, so this step is obvious to me, but you may need to resolve this issue. Most projects don't really need it.

I click "Create pull request" and send a PR now!

Pull Request sent

Now that the project maintainer steps in and accepts it, you just need to wait for an email telling you that it has been merged, or anyone else has any comments.

[...A few hours have passed...]

I received an email and the PR was rejected because the point was actually in the right place! (I do not know).

But anyway, this is one point I want to add: if the PR you accept is not accepted, please don't be angry or frustrated. The maintainers of the project need to spend months or years, and they know better than you what is better for it.

Also, especially for code, the views can be very different, and PRs that you think are great may not be welcome.

It's best to ask before doing a substantive PR to see if this is what the project really needs.

However, this is a topic in itself.


More git tutorials: