This quick how-to assumes that you have introductory experience with Git and GitHub. This guide will take you from the beginning of the process to the end.
Note: The commands and screenshots in this guide are using a test repository. Make sure to change the repository names, folder names, branch names, etc., to the repository you're working on.
Fork the repository
- Go to the GitHub repository of the project you'd like to contribute to.
- Click the
Fork
button.
Clone the fork
- You can copy the link directly from GitHub.
- Then paste it into your terminal with the
git clone
command.git clone https://github.com/GarlandKey/test-repo.git
- Don't forget to change directories!
cd test-repo
Create the appropriate branch
Note: An appropriately configured repository will not accept your pull requests to the main branch. Other naming conventions for the main branch are
master
andstable
.
- You can find the appropriate branch listed in the GitHub repository. Standard naming conventions are
dev
ordevelopment
. - Create the branch and switch to that branch.
git checkout --track origin/test-branch
Now you're ready to contribute!
If you already have some work in progress, you can now move the files into your new working directory.
- Don't forget to commit often and with short but descriptive comments about the work done or changes made.
git add . git commit -m "descriptive comment here"
- When you're ready to make your pull request, don't forget to push to your fork first.
git push
Complete your pull request
Note: A pull request should be one measurable task, such as refactoring a single function and its tests.
- Visit the GitHub repository that you're contributing to.
- Click the
Pull requests
tab. - Click the
New pull request
button. - Select the correct branch to make your pull request.
- Click
Create pull request
- Add a short but clear title and a verbose description of the changes/additions made, then click
Create pull request
.
Congratulations! You completed a pull request!
Being human, we're all prone to mistakes - I am no exception. So if you have any questions or concerns, please don't hesitate to reach out!