This holiday season give the gift of code… or anything else no matter how small to help out your favorite open source project. By joining the 24 pull requests website with your Github account, you can challenge yourself to contribute to 24 projects through December.
Find a project you want to contribute to on Github. On the top right of its page, press the fork button to create your own complete copy of the project in your own account. This allows you to add changes (commits) to your own fork, which you then share back to the original project.
Take a copy of your fork using the
git clone command:
git clone email@example.com:jr0cket/plugin-quizzes.git
Its very useful to create a branch for the change you are going to make. If there are project updates while you are creating your contribution or you just mess up so bad you just want to throw your contribution away, then a seperate branch makes this easy.
git checkout -b doc-plugin-configuration
Edit the files that make up your contribution and test your changes work before you do a local commit. Here I am updating the README.md file with some clearer instructions on how to add the plugin to your project.
git add README.md git commit -m "adding instructions on configuring the plugin"
Now copy your local commit back to your fork of the Github project. Remember to push the branch you created and not the master branch.
git push origin doc-plugin-configuration
Once you have pushed your branch to your fork, Github gives you the option to create a pull request.
When you create the pull request, it uses your commit message as the title of the pull request. You can also add further information if it helps the project maintainers understand what the change is about and why they should accept it.
Create the pull request and then wait for the project maintainters to talk a look at your change. If your change has a large green icon next to it, it means it can easily be merged into the project.
Its now time to wait for the project maintainers to review your pull request. If they like what they see and its easy to merge into the project then that may happen fairly quickly. However, as it’s their project then it is up to them what they accept. This is why small contributions are better than large, so you can develop good communication with the project maintainers with the minimum of effort.
If you want to are going to contribute to a project over time, its a good idea to create your own fork. Also, once you have cloned your fork, you should also add the original project repository.
git remote add upstream git://github.com/project/repository-name
Before you make any change or create a new branch for your change, you should get all the latest updates from the original project.
git pull upstream master
If your pull request is accepted then you can pull that commit into your own fork by pulling the changes from the original project and pushing them back to your fork.
git pull upstream master
If you have other changes in the working copy, you can always use
git stashbefore you pull in order to keep your work safe. Once you have done a pull you can use
git stash popto restore the changes back to your working copy.
This work is licensed under a Creative Commons Attribution 4.0 ShareAlike License, including custom images & stylesheets. Permissions beyond the scope of this license may be available at @jr0cket