Pull requests allow you to let others know about features and fixes that you'd like to add to a GitHub project repository.
Once you open a pull request, you'll be able to discuss and review your proposed changes with other collaborators, adding more commits if necessary, before your changes are merged into the base branch.
With a pull request, your changes are proposed in a new branch, which ensures that the master branch only contains finished and approved work.
In this short guide, I'll describe the basic process of submitting a pull request on GitHub.
- Basic knowledge of
gitvia command line
- GitHub account
- A project you'd like to contribute to
Fork the repository
Sign-in to your GitHub account and fork the repository of the project you'd like to contribute to:
This creates a new repository copy, separate from the original codebase, owned by you. Modify it as you please, it will not interfere with the original project.
Clone the repository
Download a local project codebase, by cloning the repository you've forked:
You can get the URL from here:
Navigate to the project folder:
Create a new branch
A git branch is simply a divergent line of development, a pointer to a different version of the codebase.
Create a new branch where you´ll make your changes. Give it a suggestive name, related to what the pull request intends to fix:
git checkout -b fix-challenge-12-cornify-https
Add your changes
Go ahead and implement your fix or new feature locally.
Confirm build, tests and docs
Make sure the changes you've made, still keep the build process running correctly. Run tests, if there are any, and update/regenerate the documentation, if necessary.
Most importantly, follow the contributing guidelines of the project.
Confirm updated files
Check which files have local changes pending:
Validate the exact lines that were changed in each file:
Commit the changes locally
Commit the changes to your local repository:
git add .
git commit -m "Replacing http by https in cornify.js import, to avoid insecure mixed content issues in some hosting providers"
Push your branch to GitHub
git push origin fix-challenge-12-cornify-https
When the push executes, browse to your forked repo on GitHub, where GitHub will recognize the branch you've just pulled.
Go ahead and click Compare & Pull Request:
Open pull request
One last confirmation to the changes you're adding, to the subject and body of your message, and you're ready to open your pull request:
Congratulations 🎉! You've just submitted your pull request.
A notification was sent to the owner of the repository, with a request to merge the changes.
Now, the owner of the repository will review your changes, and if everything goes well, merge them with the main branch of the project.