Back to Guides
Part 2 · 8 min read

GitHub Contribution Guide

The step-by-step workflow for getting your code from your laptop into an open-source project.

1. The Fork and Clone

You cannot push code directly to someone else's project. Instead, you create a copy (a fork) on your GitHub account.

  • Click the Fork button in the top right corner of the repository on GitHub.
  • Copy the URL of your fork.
  • Open your terminal and clone it to your computer:
git clone https://github.com/YOUR-USERNAME/repository-name.git
cd repository-name

2. Keep Your Fork Synced

Before you start coding, you need to connect your local copy to the original project (the "upstream") so you can pull the latest changes.

git remote add upstream https://github.com/ORIGINAL-OWNER/repository-name.git
git fetch upstream
git checkout main
git merge upstream/main

3. Create a Branch

Never make changes on the main branch. Always create a new branch named after the feature or issue.

git checkout -b fix-login-button

4. Write Code and Commit

Make your changes in your code editor. Test them to make sure nothing is broken. Then, commit your changes.

git add .
git commit -m "fix: updated login button color to blue"

Pro Tip: Use clear, descriptive commit messages. Many projects use Conventional Commits (e.g., fix:, feat:, docs:).

5. Push Your Changes

Push your new branch up to your fork on GitHub.

git push origin fix-login-button

6. Open a Pull Request (PR)

Go to the original repository on GitHub. You should see a green button that says Compare & pull request. Click it!

Fill out the PR template carefully:

  • Explain why you are making the change.
  • Explain how you tested it.
  • Link the original issue by writing Fixes #123 (replace 123 with the issue number). This automatically closes the issue when your PR is merged.

7. Review and Celebrate

The maintainer will review your code. They might ask for changes. Don't take it personally! Just make the changes locally, commit, and push again. The PR updates automatically.

Sign in required

Authenticate to use favourites & bookmarks

5