Contributing isn't much of a big deal once you are clear on how to begin and the process involved. In this article, I will explain the process from identifying an issue, indicating interest, making changes, and finally making a pull request.
Identifying a problem
If you are new to open source, then here is how you can find your way around an organization to get issues you can contribute to.
- check out repositories and familiarize yourself With the Issues.
=>Issues labeled with help-wanted or good first issues label are a great place to start.
=>Maybe you have new ideas, Great! Create a new issue(s) and suggest.
- Indicate interest
You indicate interest by commenting on the issues so it can be assigned to you. This is to avoid clashes of taking up an issue someone else is working on.
- Fork the repository
Forking a repo allows you to own a copy of the repository and to freely experiment with changes without affecting the original project.
Clone the repository to your PC
Get the link of your forked repo to your device terminal and clone it
$ git clone https://hostname/YOUR-USERNAME/YOUR-REPOSITORY
Create a branch
These are individual projects within a repository. These projects could have completely different files and folders or just changes in a line of code. We create a new branch in the repository in order to avoid future troubles. This will make the work on our bugfix or feature to be stored separately. Ensure to pick a meaningful name that represents the changes you plan to make in your code.
$ git branch <branch-name> //(Creates a new branch)// $ git checkout <new-branch> //(switches you into the branch)//
- Make the desire changes
You can now go ahead to make all the changes required on your repo.
- Add and commit changes
$ git add . //adds your changes to the folder // $ git status //checks the status of the changes//
Sign off your project
After making changes to your code all you have to do is to commit the changes. In some organizations signing off is a key principle while in some it is not. To sign off, all you have to do is include this in the commit.
Push your commit to GitHub
$ git push -u origin master
Pushes the changes in your local repository to your GitHub repository.
Although the first time you push from a branch, Git will complain that your local branch in your computer is not connected to a branch in the GitHub server. Just do what the command tells you to do:
$ git push --set-upstream origin fix-typo
Make a pull request
At this point you have made your changes and everything should be looking good. All that is left is to have your work reviewed and merged. There are just a few more steps to go.
finally create the PR