Rust has become a popular programming language and, according to Stack Overflow, has been the most loved language for consecutive years.
I will not repeat myself. For mastering RUST, a lot of hands-on is needed, check my previous article for more information.
Open source is a great way for beginners to get involved in coding and development. By contributing to open source projects, beginners can learn from more experienced developers and gain valuable experience. Open source also provides a great way for beginners to collaborate with others and build something that is useful for the community.
This article will help you to understand how to contribute to an open-source project from the beginning.
Firstly you need to chose a RUST project according to your level.
Please ensure that you have git installed on your machine,
If you don't have please follow this article.
Then note that you are going to need RUST installed on your computer.
Fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.
Most commonly, forks are used to either propose changes to someone else's project or to use someone else's project as a starting point for your own idea.
Go the main page's of the open source project and check the "Contribute.md" this file give you all you need to know for contributing, generally also indicates which branch is dedicate for contributing.
We are going to work locally on the project, so we need to clone the forked repository.
Clone is used to create a copy of a git repository. Clone creates a local copy of the remote repository.
git clone https://github.com/YOUR_USERNAME/project_name.git
There are a few reasons why you might want to develop on a separate branch:
It allows you to keep your development work separate from your main branch (usually "master"). This is helpful if you want to experiment with new features or ideas without affecting the stability of your main branch.
It allows you to share your work-in-progress with others without having to merge it into the main branch. This can be helpful for collaboration or feedback.
It allows you to easily "revert" your changes if you decide that they're not good after all. This can save you a lot of time and hassle compared to trying to fix things on your main branch.
Go to the cloned repository:
Create a new branch.
git switch -c your-new-branch-name
Please read carefully the Contribute.MD and check what the company's needs are.
Let's take as example CherryBomb (Rust open source API security project).
I wrote a simple function that checks an element from the OAS(open api specification) file.
Add the function to the check.rs file.
In all only two files has been changed.
Now add those changed to your branch.
git commit add -A
Now commit those changed.
git commit -m " my first contribution"
For the moment, your changes are only locally saved. We are going to save them in the cloud, in our case,to forked repository.
git push origin -u <add-your-branch-name>
In order to finish your contribution you need to pull your code.
What is a pull request?
A pull request is a way to request that someone else (usually a project maintainer) pull changes from your branch into their branch. This is usually used when you have made changes that you want to contribute to a project, but are not ready to merge them into the main branch yet.
Now the maintainer will audit and review your pull request. If there is no need to modify something, your code will be merged into the master branch, and you will get a notification email.
If you liked to read this article don't hesitate to give us a star at our GitHub repo.
Stay tuned. In my next article I will give you a list of beginner open-source repos to contribute to.
Between this, you can contribute to CherryBomb.
If you have any idea, or questions let's talk at our Discord Server: https://discord.gg/Krd4sNkk.