Skip to content

Latest commit

 

History

History
175 lines (122 loc) · 5.61 KB

File metadata and controls

175 lines (122 loc) · 5.61 KB
title Open Source on GitHub
description Learn how to contribute effectively to open-source projects on GitHub by forking, creating pull requests, managing issues, and following best practices.
tags
open source contribution
github fork
pull request
issues
github collaboration
keywords
open source contribution github
fork github repository
create pull request github
contribute to open source
github issues tutorial
sidebar_position 15

Welcome to the Git & GitHub Tutorial Series by CodeHarborHub. Contributing to open-source projects is a powerful way to learn, showcase your skills, and collaborate with the global developer community.

1. Understanding Open Source

Open-source projects are publicly accessible repositories that anyone can contribute to.
Benefits of contributing:

  • Gain real-world experience
  • Improve coding and collaboration skills
  • Build a professional portfolio
  • Network with developers globally
  • Contribute to tools you use daily

2. Forking a Repository

To contribute safely, you fork a repository — creating your own copy to work on.

Steps to Fork

  1. Go to the original repository on GitHub

  2. Click Fork → creates a copy under your account

  3. Clone your fork locally:

    git clone https://github.com/your-username/forked-repo.git
  4. Add the original repo as upstream to stay updated:

    git remote add upstream https://github.com/original-owner/repo.git

Forking ensures your changes won’t affect the main project until they are reviewed.

3. Creating a Pull Request (PR)

A Pull Request lets you submit your changes for review and merge into the main project.

Workflow for Pull Requests

  1. Create a feature branch:

    git checkout -b feature/fix-typo
  2. Make changes and commit:

    git add .
    git commit -m "Fix typo in README"
  3. Push your branch:

    git push origin feature/fix-typo
  4. Open a Pull Request on GitHub:

    • Select your branch and the original repo’s main branch
    • Add a descriptive title and explanation
  5. Collaborate with reviewers and make requested changes

  6. Once approved, your PR can be merged

Always keep your branch focused on a single task or fix.

4. Managing Issues

Issues are used to track bugs, features, or discussions.

  • Find issues labeled good first issue → ideal for beginners

  • Comment on an issue if you want to claim it

  • Reference issues in your PR using #issue-number Example:

    Fixes #23 - Corrected typo in documentation
    

Using issues helps maintain clarity and organization in large projects.

5. Contributing Guidelines

Many repositories include a CONTRIBUTING.md file:

  • Follow project-specific rules
  • Run tests before submitting PRs
  • Respect code style and linting rules
  • Include descriptive commit messages
  • Engage politely in reviews and discussions

Reading guidelines before contributing prevents rejection of PRs and builds trust with maintainers.

6. Best Practices for Open Source Contribution

  • Start small: Fix typos, documentation, or small bugs

  • Communicate: Always comment on issues or PRs before starting

  • Sync fork: Regularly update your fork from upstream:

    git fetch upstream
    git checkout main
    git merge upstream/main
  • Test thoroughly before submitting changes

  • Respect the project’s code of conduct

7. Example Contribution Workflow

# Step 1: Fork and clone
git clone https://github.com/your-username/forked-repo.git
cd forked-repo

# Step 2: Sync fork with upstream
git fetch upstream
git checkout main
git merge upstream/main

# Step 3: Create feature branch
git checkout -b feature/add-new-function

# Step 4: Make changes and commit
git add .
git commit -m "Add new function for date formatting"

# Step 5: Push branch and open PR
git push origin feature/add-new-function

This workflow ensures contributions are organized, conflict-free, and professional.

8. Summary

Topic Key Points
Forking Create your own copy of a repository to work on safely
Pull Requests Submit code changes for review and merge
Issues Track bugs, features, and discussions
Contributing Guidelines Follow project-specific rules and standards
Sync Fork Keep your fork updated with upstream changes
Best Practices Start small, test, communicate, and respect code of conduct

Next Steps

After learning open-source contribution, you’re ready to advance your Git & GitHub skills:

  • Explore GitHub Portfolio Projects
  • Engage in Hacktoberfest or community-driven events
  • Build confidence as a long-term contributor

Additional Resources


💙 This tutorial is part of the CodeHarborHub Git & GitHub series — empowering developers to contribute confidently to open-source projects worldwide.