With Hacktoberfest happening this month, everyone is so pumped up to contribute to opensource. The aim of this blog is to give you the detailed steps to follow and commands to use when you contribute to an open-source project.
When you find an open-source GitHub project to which you want to add a feature or fix an issue, you would find that you would have to make a pull request(PR) to them to review and accept your changes.
This is the basic workflow to create a pull request.
Fork -> Clone -> Create branch -> Add -> Commit -> Push -> Create Pull Request
We will see it in detail.
- Fork the Git repository - This is to create a copy of the original repository in your account.
Make sure you are cloning the repository that is in your account by checking the URL. It should have your GitHub username
Open your terminal and navigate to the parent folder for your project and execute the below command with the copied URL.
git clone <clone-url>
This will create the project folder with all the content.
Navigate into the project folder.
Create a feature branch for the changes you are going to make. Make sure the branch name implies the changes you are going to make/feature you are going to add. eg: git checkout -b fixing-border-issue (or) git checkout -b new-product-page-ui
git checkout -b branch-name
After making the changes, add them to the branch.
git add file-name #To add all the changed files git add .
Commit the changes. Give proper comments explaining the changes made.
git commit -m "your comments"
Push the changes to the branch.
git push origin branch-name