开源贡献 计算
by Wassim Chegham
由Wassim Chegham
揭开开源贡献的神秘面纱 (Demystifying Open Source Contributions)
This quick guide is mainly for first-time contributors and people who want to start helping open source projects.
该快速指南主要适用于初学者和希望开始帮助开源项目的人们。
As an author and maintainer of a bunch of open source projects, I appreciate hearing and seeing my projects being used. And I even love it when other developers step in and offer their help to fix and improve my projects.
作为许多开源项目的作者和维护者,我很高兴听到并看到我的项目正在被使用。 当其他开发人员介入并提供他们的帮助来修复和改进我的项目时,我什至喜欢它。
In this quick guide, I’d like to show you how easy it is to start contributing to any open source project. Trust me, it’s basically a no-brainer!
在此快速指南中,我想向您展示开始为任何开源项目做出贡献有多么容易。 相信我,这基本上是理所当然的!
I’ll assume you’re already familiar with Git. If that’s not the case, here is a complete guide for you.
我假设您已经熟悉Git。 如果不是这种情况,则这里为您提供了完整的指南 。
确定您要从事的项目 (Identify the project you want to work on)
First things first, start by identifying the project that’s close to your heart, or the one that you feel comfortable contributing to. I usually advise first-time contributors to start with the projects of the tools they use on their everyday job. It would make it easier to contribute to these tools since you are familiar with them and you may be already aware of some issues or missing features you want to help fix or improve.
首先,首先要确定与您内心最接近的项目,或者您愿意为之贡献的项目。 我通常建议初次贡献者从他们日常工作中使用的工具的项目开始。 由于您熟悉这些工具,并且可能已经知道要帮助修复或改进的某些问题或缺少功能,因此可以更轻松地为这些工具做出贡献。
At the same time, there is really nothing stopping you from choosing any random project you’d like to contribute to. Some people choose a project based on the technology they use, other choose a project with no particular reason, just for a challenge!
同时,实际上没有什么阻止您选择要贡献的任何随机项目。 有些人根据他们使用的技术选择一个项目,另一些人则没有特殊原因选择一个项目,只是为了挑战!
It’s up to you. Just pick one!
由你决定。 选一个!
分叉项目 (Fork the project)
You need to fork the project to your GitHub account (assuming you are using GitHub) before you start contributing. This process will basically copy the upstream project to your own GitHub projects, so you can have your own copy of the project to work on.
开始贡献之前,您需要将该项目分叉到您的GitHub帐户(假设您正在使用GitHub )。 此过程基本上会将上游项目复制到您自己的GitHub项目,因此您可以拥有自己的项目副本。
克隆并安装依赖项 (Clone and install the dependencies)
The next step would be to clone — download — the project you just cloned to your local machine so you can start working—hacking.
下一步是克隆(下载)您刚刚克隆到本地计算机的项目,以便您可以开始工作(黑客)。
If you’re mainly working on documentation, translation, or fixing typos, this is something you can definitely do directly from your browser. No need to clone the project locally. However, if the project requires you run a build step for the documentation, or running a formatting process on the documentation itself before pushing your changes, then you will have to clone the project locally and install the required dependencies.
如果您主要从事文档,翻译或拼写错误的工作,那么绝对可以直接从浏览器中完成。 无需在本地克隆项目。 但是,如果项目要求您运行文档的构建步骤,或者在推送更改之前对文档本身运行格式化过程,那么您将不得不在本地克隆项目并安装所需的依赖项。
Once you have the project cloned locally, you need to make sure to carefully read the CONTRIBUTING.md file — or the README.md — or any other file describing all the necessary steps to run and build the project locally. In case you are stuck, just ask the project’s maintainers for assistance and they’ll be happy to onboard you.
将项目克隆到本地后,需要确保仔细阅读CONTRIBUTING.md文件(或README.md )或任何其他描述在本地运行和构建项目的所有必要步骤的文件。 万一您陷入困境,只需向项目的维护者寻求帮助,他们将很乐意为您服务。
Don’t be shy! You are providing your help “for free”, and the project’s maintainers — including myself — can only be thankful for that!
别害羞! 您正在“免费”提供帮助,项目维护者(包括我自己)只能为此感到感激!
您可以做些什么来帮助您 (What you can do to help)
Most first-time contributors usually get confused by this step and what it actually implies. Let’s clarify first what a “contribution” is.
大多数初次贡献者通常对此步骤及其实际含义感到困惑。 让我们首先说明什么是“贡献”。
Contributing to an open source project doesn’t only mean writing code and fixing technical issues. Open source contributions have literally no limits or boundaries. They can be (from quick to more engaging):
为开源项目做贡献不仅意味着编写代码和解决技术问题。 开源贡献实际上没有任何限制或界限。 它们可以是(从快速到更具吸引力):
- Using the tool and thanking the team working on it, 使用该工具并感谢使用该工具的团队,
- Promoting the project at events or online, 通过活动或在线推广项目,
- Helping answering questions, 帮助回答问题,
- Fixing typos in documentation, 修正文档中的错别字,
- Writing or translating documentation, 编写或翻译文档,
- Helping reproducing bugs and reported issues, 帮助重现错误和报告的问题,
- Refactoring existing code, 重构现有代码,
- Fixing — technical — bugs, 修复-技术性-错误,
- Writing unit tests, 编写单元测试,
- Implementing new features, 实施新功能,
- Challenging the core architecture design 挑战核心架构设计
You name it!
随你便
It’s basically anything you can do to help improve a project.
基本上,您可以采取任何措施来改善项目。
确定要“解决”的问题 (Identify an issue to “fix”)
By “fixing” we mean “providing help”. I usually recommend that first-time contributors start small. Pick something you can easily and quickly fix. Typos in documentation are great. Plus, you will able to read the whole project documentation and get even more familiar with the project —it’s great if you want to get the high-level picture!
“修复”是指“提供帮助”。 我通常建议初次参与的人从小做起。 选择可以轻松快速修复的内容。 文档中的错别字很棒。 另外,您将能够阅读整个项目的文档并更加熟悉该项目-如果您想获得高水平的图片,那就太好了!
Next, writing or fixing unit tests is also another easy way to get started contributing. Unit tests allow you to progressively dive into the implementation details of a specific feature, at your own pace. If the project has integration tests, start with those before unit tests. This way you will have an understanding of the high-level architecture without digging into the implementation details.
接下来,编写或修复单元测试也是开始贡献的另一种简便方法。 单元测试使您可以按照自己的进度逐步深入研究特定功能的实现细节。 如果项目具有集成测试,则从单元测试之前的测试开始。 这样,您无需深入了解实现细节即可了解高级体系结构。
Having said that, you should feel free to pick up any issue you feel comfortable fixing. However, just make sure to let the other contributors on the project know that you are working on that particular issue by commenting on the related thread on the project’s repository page.
话虽这么说,您应该随心所欲地解决任何问题。 但是,只需确保在项目的存储库页面上对相关线程进行评论,就可以让项目中的其他贡献者知道您正在处理该特定问题。
应用“修复” (Applying the “fix”)
This step really depends on the type of issue you’re solving. Just make sure you read carefully the project’s contributing guidelines and comply to them. Most mainstream open source projects have a strict process of guidelines and formatting rules that all contributors must follow.
此步骤实际上取决于您要解决的问题的类型。 只要确保您仔细阅读了项目的贡献准则并遵守它们即可。 大多数主流开源项目都有严格的准则和格式规则过程,所有贡献者都必须遵循。
Also, feel free to ask the maintainer or other contributors for help if you’re stuck or have any question about anything.
此外,如果您遇到困难或有任何疑问,请随时向维护者或其他贡献者寻求帮助。
提交并推动您的更改 (Commit and push your changes)
Once your fix is ready, you should be proud of yourself! You’ve done the hard work, the rest is just a formality.
准备好修复程序后,您应该为自己感到骄傲! 您已经完成了艰苦的工作,其余的只是形式。
So next, you need to commit and push your changes to your own copy of the project — the one you forked!
因此,接下来,您需要提交所做的更改并将其推送到您自己的项目副本–您创建的副本!
Again, read carefully the project’s contributing guidelines and check how you should format your commit messages and branch names. Every project has its own convention. Also, it is considered a good practice to push your changes — fix — to a different branch other than “master” or “develop”, so you can easily merge or rebase your changes later on — in case you have to do so.
同样,请仔细阅读该项目的贡献准则,并检查如何格式化提交消息和分支名称。 每个项目都有自己的约定。 另外,将更改(修复)推送到除“主”或“开发”之外的其他分支上也是一个好习惯,这样您以后就可以轻松地合并或重新设置您的更改,以备不时之需 。
It is usually appreciated, sometimes mandatory, to include a detailed description about your changes/fix/implementation in the commit’s body. This will help others to instantly know about the changes introduced by this commit.
通常,最好在提交的正文中包含有关您的更改/修复/实现的详细描述,有时是强制性的。 这将帮助其他人立即了解此提交引入的更改。
发送公关请求请求 (Send a PR—Pull Request)
Now, you’re ready to send your changes to the original project — the upstream project. For that, you’ll have to open a Pull Request.
现在,您可以将更改发送到原始项目-上游项目。 为此,您必须打开一个请求请求。
Now, send your PR and cross your fingers! Sometimes, you will get asked by the project’s maintainers to update or provide some changes to your changes before they can merge your PR.
现在,发送您的PR并交叉手指! 有时,项目维护人员会要求您更新或提供对更改所做的某些更改,然后他们才能合并您的PR。
If the project’s maintainers can’t merge your PR for some reason (usually a technical one), don’t be upset or disappointed! Give it another shot or simply move on and take another issue to fix. That’s totally fine, it’s part of the contribution.
如果项目的维护者由于某种原因(通常是技术原因)无法合并您的PR,请不要沮丧或失望! 再试一下,或者继续前进,并解决另一个问题。 很好,这是贡献的一部分。
I hope you now have a clear idea about Open Source contributions and how easy they can be.
我希望您现在对开放源码贡献及其实现的难度有一个清晰的认识。
Cheers.
干杯。
Follow me @manekinekko on Twitter for more updates about Open Source.
在Twitter上关注我@manekinekko ,以获取有关开源的更多更新。
翻译自: https://www.freecodecamp.org/news/demystifying-open-source-contributions-c60fe2bde6d0/
开源贡献 计算