Code 16: Open Source as a Beginner

Learning How To Contribute to Open Source Projects as a Beginner
coding
python
Author

Tony Phung

Published

October 23, 2024

FreeCodeCamp Open Source Beginners Guide

1. Questions to be answered

  • What exactly is open source?
  • How can you get started contributing?
  • What should you expect?

2. What is open source?

A projects where it’s source code is:

  • made available
  • to the public to
    • view,
    • use,
    • modify, and
    • distribute under a permissive license.

3. How to get started?

Level 1 Checklist:

  • Check out if it has a license file.
  • Check when the last commit was made. This will help you know if the maintainers are active and also give you an estimate on how long it will take to respond to your contribution.
  • Look for the number of contributors.
  • Check how often people make commits.

Level 2 Checklist:

  • Does it have any open issues?
  • How long does it take for maintainers to respond?
  • Is there an active discussion on an issue?
  • Are the issues getting closed regularly?
  • How many open pull requests are there?
  • How recently was the latest pull requests merged?
  • Do the maintainers thank people for contributing?

4. How to Submit a PR Request?

4.1 Step-by-Steps

  • Fork: os project becomes “https://github.com//projectname”
  • Clone:git clone https://github.com/<YourUserName>/<projectname>
    • this creates a copy of project on local machine
  • Create local folder + branch: cd to folder + eg git checkout -b tonyjustdev-branch
    • see all changes: git status
    • add all changes: git add *
    • commit changes: git commit -m "message here"
    • push to remote: git push origin tonyjustdev-branch

4.2 Advantages of Above Steps

  • It allows you to contribute to another repo without needing administrative privileges to make changes to the repo.
  • It allows others to review your changes and suggest corrections, additions, edits, and so on.
  • It gives repo administrators control over what gets added to their project repo.

5. Let’s do it myself!

5.1 Fork a repo first contributions

By forking a repo, I am creating a copy of the particular repository in my own github account:

  • Click fork button on top right of the repo
  • Rename [Repository name] (if you want)
  • Click Create fork

Repo used: https://github.com/firstcontributions/first-contributions.

5.2 Clone your forked repo tonyjustdevs/first-contributions

  • Copy URL and git clone <your copied url>

5.3 Create local branch

5.3.1 Clone to local with Windows Terminal

My current workflow involves firstly opening VSCode , then creating/switching to a branch in the Terminal of VSCode.

  • cd to cloned folder
  • open vscode
  • create/switch to new branch

(I have not had a chance to test whether there a difference to creating the branch first before launching VS Code. I currently run almost all terminal commands in VSCode’s Terminal rather than Windows Terminal)

5.3.2 Create Local Branch with VS Code’s Terminal

VSCode shows which branch you’re currently in which is neat.

6. Make Changes via IDE (VSCode)

  • Add myself to Contributors.md, preview, then save the file [Label 1 & 2]
  • Check status: git status [Label 3]
  • Add changes (local branch): git add Contributors.md [Label 3]
  • Commit: git commit -m "Add your-name to Contributors list" [Label 3]
  • Push (remote branch): git push -u origin your-branch-name [Label 3]

7. Create Pull Requests

  • Go to your forked repo and you should see a Compare & pull request button to click. Click it.

  • Then Submit via Create pull request button.

8. Wait for it to be Merged

9. Merge Successful!

10. Don’t forget to Star🌟 it

11. Don’t let the fame get to you Tony