Submitting PRs to GitHub Open Source Projects

This article introduces how to submit PRs to GitHub open source projects, including the advantages, implementation details, and relevant resources. These steps can help improve efficiency when contributing to open source projects on GitHub.

Mar 17, 2024 · 1 min read · 213 Words · -Views -Comments · Programming
Git 🇨🇳 阅读中文版
Read with AI

Choose an AI assistant

ChatGPT Open in a new tab with the article link and prompt
Claude Copy the prompt, then open Claude

Open Claude
Trouble reading the article?

If the prompt is missing, copy the full prompt below into your AI assistant. If the AI cannot read the article, paste the visible passage you want to discuss and add your question.

Working on your own projects on GitHub is relatively simple, but how to collaborate and contribute to open source projects is more interesting. Here I’m documenting the experience I’ve accumulated contributing to open source projects like inshellisense.

https://static.1991421.cn/2024/2024-03-17-144331.png

Using the inshellisense project as an example

  1. Fork the open source project, microsoft/inshellisense => alanhg/inshellisense

  2. Create a new branch, such as fix/file-template, for development

    • Update unit tests if available, ensure tests pass
    • Don’t use the main branch directly because the main branch is used to sync project updates, avoiding situations where the original project gets new commits during development
    • Creating a new branch also allows better use of branch names to indicate whether the changes are features, fixes, etc.
  3. Commit to the upstream repository alanhg/inshellisense

  4. If the open source project microsoft/inshellisense has updates, pull the updates using Sync fork

  5. Rebase the fix/file-template branch with the main branch to ensure it’s up to date

  6. Push again to the upstream repository alanhg/inshellisense

  7. Initiate a Pull Request, describe the changes in detail, and wait for merging

    • If there are any issues during PR review, provide active feedback and resolve them
  8. Once successfully merged, celebrate 🎉

  9. You can delete the fix/file-template branch, switch to the main branch, and if there are new contributions to make, repeat step 5 for operation

Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover