NOTE: Only contribute if you are a Netsoc Member!
In order to promote Open Source contributions, Digital Ocean runs a yearly challenge to have 4 Pull Requests successfully merged into an open source project on GitHub. As a reward you get a free t-shirt and most importantly stickers!
On many systems, this is already installed for you. Otherwise you can install it by downloading the git CLI.
You must also have a GitHub account. You can create an account on their website.
Detailed Instructions for Git Bash Installation
One setup item that is important is to tell Git who we are.
git config --global user.name "Your Username"
git config --global user.email "Your Email"
To have GitHub credit the changes to you, the username must match your GitHub username and the email must match the email you made GitHub with.
Alternatively, if you don't want to disclose your email, you can use a private email address provided by GitHub at Settings -> Emails.
When you're on the main page of the repository, you'll see a "Fork" button on the top right hand side of the page, underneath the user icon. Click on the button to start the forking process.
Now we'll clone our repository using the git clone
command along with the url that points to your fork of the repository.
git clone https://github.com/{username}/Hacktoberfest.git
Next, we'll change directory, so that we're working in the directory of the repository.
cd Hacktoberfest
We will also add a new remote so that we can sync with official repo.
git remote add upstream https://github.com/UCDNetsoc/Hacktoberfest
git checkout -b feature_name
The name of the feature branch isn't too important, just give it a descriptive name so you can identify it later on.
Remember, we can use the
git status
command to show us what branch we are on.
- Open this folder in your favourite editor.
- Add your name to the
CONTRIBUTERS.md
file - Create a "Hello, World!" script in a language of your choice.
- Add this file in the helloworld directory.
- Additionally, if "Hello, World!" is too boring, you can attempt to implement fizzbuzz in your favourite language.
- Add this script in the fizzbuzz directory.
If you want to commit all changes you can do:
git add .
git commit -m "Description of commit changes"
Sometimes its better to split your changes into multiple commits:
git add Contributers.md
git commit -m "Added {name} to X"
git add helloworld/helloworld_{name}
git commit -m "Added hello world in {language}"
git add fizzbuzz/fizzbuzz_{name}
git commit -m "Added fizzbuzz in {language}"
Remember, each time you make a change to a file, you will need to stage the changes using the
git add {file}
command again. Being able to stage changes individually allows you to make lots of changes without worrying about committing them immediately.
We've now laid all the groundwork to push our code to GitHub. So lets do that. In the command line type the following:
git push -u origin feature_name
Notice we used the -u
flag. That flag sets the upstream repo, which causes our local master branch to track the master branch on the remote repo which is aliased as origin. We can now use just the git push
command and it will know where to push it, because we set our upstream branch.
Once you push your changes to GitHub, a Compare & pull request tab will appear. Click it and you'll be taken to an screen that looks like this:
GitHub will allow to create a pull request if there is no competing code. You should add a title and a brief comment. Then, press the "Create pull request" button.
Once, you've submitted your code, one of the Sysadmins will take a look it over and then merge it into the main repository
Here are some resources for learning more about Git:
There are many different open source projects on GitHub, that you can help. Here's a repositories that have tasks for beginners:
- https://github.com/mungell/awesome-for-beginners
- https://up-for-grabs.net/#/
- http://issuehub.io/
- https://www.firsttimersonly.com/
- https://goodfirstissues.com/
Once you get comfortable, you can find more open source projects that you can contribute to at:
- https://www.codetriage.com/
- https://24pullrequests.com/ (This is like Hacktoberfest but in December)