博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何在GitHub上发出第一个拉取请求
阅读量:2502 次
发布时间:2019-05-11

本文共 4815 字,大约阅读时间需要 16 分钟。

Many tutorials exist about this topic but they make things overly complicated by assuming one has to contribute code to a project. So there’s all the setup before that.

有许多关于该主题的教程,但是它们通过假定必须向项目贡献代码而使事情变得过于复杂。 因此,在此之前有所有的设置。

What if you just need to edit a file, maybe the project README to fix a typo?

如果您只需要编辑文件,也许是项目README来解决错字怎么办?

You don’t need to know how to code or how to use Git to do that. But once you start doing Pull Requests, you can do many more things and collaborate on projects with other people! And maybe this will push you to also contribute code later on.

您不需要知道如何编码或如何使用Git来做到这一点。 但是,一旦开始执行“拉取请求”,您就可以做更多的事情,并与其他人协作进行项目! 也许这将促使您以后也贡献代码。

I assume you already have a (free) account. If you don’t, then go to and get one.

我假设您已经有一个(免费的) 帐户。 如果不这样做,请访问并获取一个。

Let me show you the process.

让我告诉你这个过程。

I went to this page and I found a possible typo. This line is missing a dot at the end.

我转到此页面 ,发现了可能的错字。 这条线的末尾缺少一个点。

The article I want to edit

I’m not a grammar nazi, this is just for the sake of finding an example 😄

我不是语法纳粹,这只是为了寻找一个例子😄

I know that site is hosted on GitHub, and that exact article is hosted here:

我知道该网站托管在GitHub上,并且确切的文章托管在这里: :

The github folder of the article

I open the index.md file directly on GitHub and I press the pencil icon in the file toolbar. Hovering it says “Fork this project and edit the file”.

我直接在GitHub上打开index.md文件 ,然后按文件工具栏中的铅笔图标。 将鼠标悬停在上面时会显示“分叉此项目并编辑文件”。

The index.md file

This brings up an editor view with this information:

这将显示以下信息的编辑器视图:

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.

您正在编辑一个没有写权限的项目中的文件。 提交对此文件的更改会将其写入到分支flaviocopes / web.dev中的新分支中,因此您可以发送拉取请求。

The editor view

I can go and add that dot, then at the form at the bottom I explain the changes I made:

我可以添加该点,然后在底部的表单中说明所做的更改:

Propose file change

I pressed the “Propose File Change” button and a compare view showed up.

我按下“建议更改文件”按钮,然后出现一个比较视图。

Compare view

There I can review the changes I made, to make sure all is fine, and finally I can click the “Create Pull Request” button. Currently the changes have been made to your fork of the project, which was made automatically by GitHub when you clicked the pencil icon.

在这里,我可以查看所做的更改,以确保一切都很好,最后,我可以单击“创建请求请求”按钮。 当前,已对项目的分支进行了更改,这是由GitHub在单击铅笔图标时自动进行的。

Open pull request

At the top of this view you can see that I’m about to submit a PR to the GoogleChrome/web.dev project from my form flaviocopes/web.dev, from my branch patch-2 to their master branch.

在此视图的顶部,您可以看到我即将从flaviocopes/web.dev (从我的分支patch-2到其master分支)向GoogleChrome/web.dev项目提交PR。

Pressing the “Create Pull Request” button shows another form where I can write a detailed description for the Pull Request.

按下“创建请求请求”按钮会显示另一种形式,我可以在其中编写请求请求的详细说明。

Pull Requests can contain many different changes, so in theory you could have lots of files edited in the same PR, this is why you can add a summary.

拉取请求可能包含许多不同的更改,因此从理论上讲,您可以在同一PR中编辑许多文件,这就是为什么您可以添加摘要的原因。

This repository has a template for the PR text, to help the team manage it. Our PR is very simple so I remove the template and just paste the content from the commit message from before.

该存储库具有用于PR文本的模板,以帮助团队进行管理。 我们的PR非常简单,因此我删除了模板,仅粘贴了之前提交消息中的内容。

Notice the hint on the right? They tell me the project has a CONTRIBUTING.md file, which explains how to contribute and the guidelines. Pretty cool.

注意右边的提示吗? 他们告诉我该项目有一个CONTRIBUTING.md文件,该文件说明了如何进行贡献和指导原则。 很酷

Contributing

Seems we need to sign a CLA (Contributor License Agreement) to complete our PR. I already signed a Google CLA in the past so this step is clear for me, but you might need to fix that. Most projects don’t really need it.

似乎我们需要签署CLA(贡献者许可协议)才能完成PR。 我过去已经签署了Google CLA,因此这一步骤对我来说很清楚,但是您可能需要解决此问题。 大多数项目并不真正需要它。

I clicked “Create pull request” and the PR is now sent!

我单击“创建请求请求”,现在就发送PR!

Pull Request sent

Now it’s up to the project maintainers to step in and accept it, you just need to wait for an email telling you that it’s been merged, or any comments other people had.

现在由项目维护者介入并接受它,您只需要等待一封电子邮件,告诉您它已被合并,或者其他人有任何评论。

[… a couple hours passed by…]

[…几个小时过去了…]

I got an email back, the PR was rejected because that dot was actually in the correct place! (I didn’t know that).

我收到了一封电子邮件,公关被拒绝了,因为那个点实际上在正确的位置! (我不知道)。

But anyway here’s a thing I wanted to add: don’t be angry or upset if a PR you submit is not accepted. The maintainers of the project work on it for months or years and they know better than you about what’s better for it.

但是无论如何,这是我想补充的一点:如果您提交的PR不被接受,请不要生气或沮丧。 项目的维护者需要花费数月或数年的时间,他们比您更了解什么对它更好。

Plus, especially with code, views might be very very different and a PR you think is great might not be welcome.

另外,尤其是对于代码,视图可能会非常不同,并且可能不欢迎您认为很棒的PR。

It’s also best to ask before working on a substantial PR, to see if it’s something the project actually needs.

也最好在进行实质性PR之前先询问一下,看看它是否是项目真正需要的东西。

But this is a topic on its own.

但是,这本身就是一个话题。

翻译自:

转载地址:http://ueqgb.baihongyu.com/

你可能感兴趣的文章
获取控制台窗口句柄GetConsoleWindow
查看>>
Linux下Qt+CUDA调试并运行
查看>>
51nod 1197 字符串的数量 V2(矩阵快速幂+数论?)
查看>>
OKMX6Q在ltib生成的rootfs基础上制作带QT库的根文件系统
查看>>
zabbix
查看>>
多线程基础
查看>>
完美解决 error C2220: warning treated as error - no ‘object’ file generated
查看>>
使用SQL*PLUS,构建完美excel或html输出
查看>>
SQL Server数据库笔记
查看>>
X-Forwarded-For伪造及防御
查看>>
android系统平台显示驱动开发简要:LCD驱动调试篇『四』
查看>>
Android 高仿微信头像截取 打造不一样的自定义控件
查看>>
Jenkins的初级应用(1)-Publish Over SSH
查看>>
利用正则表达式群发定制邮件
查看>>
【原】RDD专题
查看>>
第三周——构建一个简单的Linux系统MenuOS
查看>>
Docker 的两类存储资源 - 每天5分钟玩转 Docker 容器技术(38)
查看>>
Codeforces 257D
查看>>
常用的20个强大的 Sublime Text 插件
查看>>
ajaxfileupload.js在IE中的支持问题
查看>>