In this post we will look how to create a pull request to an existing project to introduce some changes required in the project.
So in order to create a pull request one must have to go through the process listed below:
So let's get started.
In order to add changes to the project one must the local copy of the project. In most cases when creating pull request for the project which you do not already own, one must first fork the project.
Forking a project means to create a independent copy of the project, just like creating a new repository which belongs to you under your account. This basically avoids to directly pushing changes to the original project, which may also require you the permission to directly push to the repository which you do not own or maintain.
To fork the project:
This will create the repository with same name under your Github account.
Additionally, clone the repository under your account to your system using the following command, but before that click on the clone option in repository, and copy the URL.
Execute the following command in terminal.
git clone PROJECT_URL.git
So, in-order to introduce changes, one must create a separate branch and then start editing the project or files under it.
To create a separate branch, open the terminal in the cloned project repository/folder and execute the following command replacing the name of branch as per your choice.
git checkout -b YOUR_BRANCH_NAME
Now it's time to implement required changes in the project. Just go ahead and do whatever changes you want.
Once the changes are done, one needs to commit those changes to the branch using the following command below.
git commit -a -m "Message for your commit (description of changes)"
After committing the changes push these changes to the branch using the command below.
git push origin YOUR_BRANCH_NAME
So, once you are done with the changes and committing and pushing them to the repository, now its time to create a pull request to the original repository of project, so that owner or maintainers of the project can review your changes and take decision whether or not to merge your changes with the project.
So to create pull request do the following.
Once owner/maintainer of the original repository agrees to merge the changes introduced, your pull request will get merged with the project. And that's a great thing, Congratulations! you made a contribution to the project.
Thanks for being with me till here! I hope now you feel ready to contribute to the projects out there. To read more content like this checkout my latest blog here.