By doing open-source contributions, you will learn a lot. It allows you to become a part of the open-source community. It can be hard at the beginning, but it’s definitely worth it.
How do you make a pull request? How to ask the maintainers to merge it?
First of all, you should know the basics of git. You’ll need a GitHub account as well.
If you don’t have one, you can create it here.
If you want to practice a little bit first, you can use this demo repository.
Don’t worry, I created it for this purpose.
Once you’re there, click the “Fork” button.
This will copy the whole project under your GitHub user.
The link will look like this
Open your terminal, and run the following command:
git clone https://github.com/<YourUsername>/git-demo.git
This will create a local copy of the repository.
For this we will use the following command:
git remote add upstream https://github.com/markodenic/git-demo
We can do this by running the command:
git checkout -b my-branch
This will create a new branch, and switch to it.
Now, the time has come, we actually add some code. 🙂
After adding the changes, you can check them by running
If everything is as expected, we can add the code to the staging area:
git add .
This is the last step before pushing the code to the repository.
Run the command:
git commit -m "Adding an awesome feature to my-branch"
Finally, we’re ready to push the changes.
git push is the command we need in this case. Let’s run it:
git push -u origin my-branch
Once we pushed the changes to our repository, we are ready to open the pull request.
Go back to your repository and click on the “Compare and Pull Request” button.
If everything went OK, the maintainer of the repository will merge your pull request.
- Find a project you want to contribute to.
- Fork the repo.
- Clone the repository.
- Create a new remote for the upstream repository.
- Create a new branch.
- Add your changes.
- Commit your changes.
- Push the changes to your repository.
- Create a pull request.
See you on GitHub.
If you have any questions, you can write me on Twitter .
I write monthly emails full of real-world web development tips and resources.
No spam, unsubscribe at any time. Subscribe here .
Originally posted on my blog.