First Open-Source Contribution: A Complete Guide to Your First Commit
Learn how to make your first open-source contribution step by step. From forking repositories to creating pull requests, this guide covers everything you need to start contributing to open-source projects.

What is Open-Source Contribution?
Open-Source Contribution involves contributing to the development of open-source software. It helps us understand the codes of different organizations, work on real-world projects, and contribute to these projects.
Open-source contribution is not just about writing code—it's about being part of a community, learning from others, and helping improve software that millions of people use every day.
What Does "Commit" Mean in Open-Source Contribution?
In open-source contribution, we can say a commit is adding some features or changes to the project, like adding features, resolving bugs, etc. These commits help organizations improve their features and remove bugs.
A commit represents a snapshot of your changes and includes a message describing what you've done. It's a fundamental concept in version control that allows teams to track changes over time.
Steps for First Contribution in Other Repositories
1. Fork the Repository
Fork the desired repository. For example, if you want to contribute to the js-hindi repository, navigate to the repository on GitHub and click the Fork button in the top-right corner, then click Create Fork.

This creates a copy of the repository under your GitHub account, allowing you to make changes without affecting the original project.
2. Create a Local Folder
Create a folder on your computer where you want to store the repository. This keeps your projects organized and makes it easier to manage multiple contributions.
3. Clone the Repository
Open the terminal (or Command Prompt if you're using Windows) and type the following command to clone your forked repository:
git clone "the link of the repository which is a fork"
Then navigate into the repository:
cd RepositoryName

4. Make Your Changes
Now you can make the changes you want to contribute. This could be:
- Adding new features
- Fixing bugs
- Improving documentation
- Optimizing code
- Adding tests
5. Commit Your Changes
Follow these commands to commit your changes:

Understanding the Git Commands
Let me explain each command and why we use them:
git clone
A git clone is primarily used to point to an existing repository and make a clone or copy of that repository in a new directory at another location.
git clone https://github.com/yourusername/repository-name.git
cd
To change the current working directory to the cloned repository.
cd repository-name
git remote add upstream
We use git remote add upstream to specify the remote repository from which we want to pull changes or updates.
git remote add upstream "remote repository link from which you want to pull changes"
This connects your local repository to the original project, allowing you to stay up-to-date with the latest changes.
git remote
We use git remote to manage the remote repositories associated with our local Git repository.
git remote
This displays a list of all configured remote connections.
git pull upstream main
We use git pull upstream main to fetch and merge changes from the upstream repository's main branch into our local repository's current branch.
git pull upstream main
This ensures your fork is synchronized with the original repository before you start making changes.
git checkout -b
We use git checkout -b to create a new branch and switch to it at the same time.
git checkout -b "new-branch-name"
Creating a new branch for each feature or bug fix keeps your work organized and makes it easier to manage multiple contributions.
git branch -a
We use git branch -a to list all the branches in our local repository as well as the remote repositories that are currently available.
git branch -a
git add .
We use git add . to stage all changes in the current directory and its subdirectories for the next commit.
git add .
You can also add specific files:
git add filename.js
git commit -m
We use git commit -m to create a new commit with a message that describes the changes we've made.
git commit -m "Write the message for the author about what you changed in the repository"
Write clear, descriptive commit messages that explain what and why you changed something.
git remote -v
We use git remote -v to display a list of all the remote repositories that are currently associated with our local Git repository.
git remote -v
git push -u origin
We use git push -u origin to push our local changes to the origin remote repository and set it as the default upstream branch for the current branch.
git push -u origin "the-new-branch-name-that-you-created"
Compare and Pull Request
After pushing your changes, navigate to your forked repository on GitHub. You'll see a prompt to Compare & Pull Request.

Click on Compare & Pull Request to start the process of submitting your contribution.
Create Pull Request

-
Leave a detailed comment explaining:
- What changes you made
- Why you made them
- Any additional context
-
Click Create Pull Request
Your first pull request is now generated! 🎉
The project maintainer will review your changes. If they find them correct, they will accept your pull request. If they need modifications, they'll suggest changes for you to make to your commit.
Best Practices for Open-Source Contributions
- Read the Contributing Guidelines: Most projects have a CONTRIBUTING.md file with specific instructions
- Start Small: Begin with documentation fixes or small bug fixes
- Communicate: Ask questions if you're unsure about something
- Be Patient: Maintainers are often volunteers; reviews may take time
- Follow Code Style: Match the existing code style of the project
- Write Tests: If applicable, include tests for your changes
- Update Documentation: If you add features, update the docs
Conclusion
The initiative matters the most. The first step is to contribute, which helps you gain more knowledge in your field. Open-source contribution helps you:
- Build connections with people who are contributing to projects
- Gain knowledge from experienced developers in your field
- Improve your coding skills by working on real-world projects
- Build your portfolio and demonstrate your abilities
- Give back to the community and help improve software you use
Don't be afraid to start small. Every expert was once a beginner, and the open-source community is generally welcoming to newcomers. Your first contribution might feel daunting, but it's a valuable learning experience that will help you grow as a developer.
Happy contributing! 🚀