【笔记】【英文】【如何贡献一个开源项目?】[Note]How to contribute to opensource?

resource here

[Note]How to contribute to opensource?

Step 1: Set up a working copy on your computer
  1. git clone.
  2. git remote add upstream.
Step 2: Get it working on your machine

If you get it working, but the documentation is unclear, then improving that bit should be your first PR to the project.

Step 3: Do some work

It’s usually best to start by fixing a bug that is either annoying you or you’ve found on the project’s issue tracker.

Branch!

Put each piece of work on its own branch!

  • Bug fixing: branch from master.
  • Adding a new feature: branch from develop.
  1. git checkout master
  2. git pull upstream master && git push origin master
  3. git checkout -b hotfix/readme-update

The git pull command will sync our local copy with the upstream project and the git push syncs it to our forked GitHub project. If the project uses git-flow, then there are specific naming conventions where the branch is prefixed with “hotfix/” or “feature/”.

  • If the project has tests: run them to ensure you haven’t broken anything.
  • You may also add a new test to show that your change fixes the original problem.
Step 4: Create the PR

Push your branch to the origin remote and then press some buttons on GitHub.

  1. git push -u origin hotfix/readme-update

-u flag links this branch with the remote one, so that in the future, you can simply type git push origin.

Swap back to the browser and navigate to your fork of the project and you’ll see that your new branch is listed at the top with a handy "Compare & pull request" button:

在这里插入图片描述
在这里插入图片描述
Double check that the diff of changes contains what you expect.

Step 5: Review by the maintainers

Maintainers is considering:

  • What This Change Does?
  • Does It Relate To A Ticket (And Only One Ticket)?
  • Do These Changes Touch The Tree As I’d Expect?
  • Does The Commit History Make Sense?
  • Eyeball The Diff.
  • Run The Code.
To sum up
  1. Fork the project & clone locally.
  2. Create an upstream remote and sync your local copy before you branch.
  3. Branch for each separate piece of work.
  4. Do the work, write good commit messages, and read the CONTRIBUTING file if there is one.
  5. Push to your origin repository.
  6. Create a new PR in GitHub.
  7. Respond to any code review feedback.

The best open source project to pick is the one that you are using yourself.The maintainers will appreciate it!

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值