Announcement: Would you like to become a maintainer on this project and help keeping it going? If you are interested send me a DM on Twitter and read the maintainer's guide.
This is a tutorial to help first-time contributors to participate in a simple and easy project.
This tutorial is also available in other languages (Portuguese, Spanish, and Italian currently. Translations very welcome).
- Make a contribution to an open source project.
- Get more comfortable in using GitHub.
- This is for absolute beginners. If you know how to write and edit an anchor tag
<a href="" target=""></a>
then you should be able to do it. - It is for those with a little more experience but who want to make their first open source contribution, or get more contributions for more experience and confidence.
Any web developer, aspiring or experienced needs to use Git version control, and GitHub is the most popular Git hosting service used by everyone. It is also the heart of the Open Source community. Getting comfortable using GitHub is an essential skill. Making a contribution to a project boosts your confidence and gives you something to show on your GitHub profile.
If you are a new developer and you are wondering if you need to learn Git and GitHub then here is the answer: You Should've Learned Git Yesterday.
You are going to contribute a card just like this one to this project's web page. It will include your name, your Twitter handle, a short description, and 3 links to useful resources for web developers that you recommend.
You will make a copy of the card template inside the HTML file and customise it with your own information.
Contribute: |
---|
First let's get setup to do the work
- Login to your GitHub account. If you don't yet have an account then join GitHub. I recommend that you do the GitHub Hello World tutorial before you continue.
- Download GitHub Desktop app.
- Alternatively if you are comfortable using Git on the command line you can do so (here's first-contributions, a similar project that can serve as a guide for the commands needed). OR
- If you use VS Code it comes with integrated Git and allows you to do what we need straight from the editor.
- However the simplest and easiest way to follow this tutorial is using GitHub Desktop.
Now that you are all setup let's get on with the business of contributing to the project.
Become an open source contributor in 10 easy steps.
Estimated time: Less than 30 minutes.
- The objective here is to make a copy of this project and place it in your account.
- A repository (repo) is how a project is called on GitHub and a fork is a copy of it.
- Make sure you are on the main page of this repo.
|
---|
- You now have a complete copy of the project in your own account
- Now we want to make a local copy of the project. That is a copy saved on your own machine.
- Open the GitHub desktop app. In the app:
|
---|
- This will take a moment as the project is copied to your hard disk. I recommend that you keep the default path which is usually
..\Documents\GitHub
. - Now you have a local copy of the project.
- Once the repo has been cloned and you have it open in GitHub desktop it is time to create a new branch.
- A branch is a way to keep your changes separate from the main part of the project called
Master
. For example if things go wrong and you are not happy with your changes you can simply delete the branch and the main project won't be affected.
|
---|
|
---|
- You can name it whatever you want, but since this is a branch to add a card with your name to the project, calling it
your-name-card
is good practice because it keeps the intention of this branch clear.
|
---|
- Now you have created a new branch separate from the master.
- For the next steps make sure you are working in this branch. You will see the name of the branch you are on at the top center of the GitHub desktop app where it says Current branch.
Do NOT work on the master
branch
- Now we need to open the file we are going to edit with your favourite code editor.
- Find the project folder on your computer. If you have kept the default this should be something like
your-computer > Documents > GitHub > Contribute-To-This-Project
- The
index.html
file is directly in theContribute-To-This-Project
folder.
- Now you have the file you are going to edit open in your editor and you are ready to start making changes to it.
- We will make a copy of the card template to start working on it
- This now is your card for you to customise and edit.
- We will now start editing the html, changing the customizable fields in our card.
|
---|
|
---|
- If you prefer to use a contact other than Twitter you will need to replace the twitter icon
<i class="fa fa-twitter"></i>
by going to Font Awesome Icons searching for the right icon and replacing only thefa-twitter
part with the new icon likefa-facebook
for example. Then Follow the same steps above.
|
---|
- Make sure you have saved all your changes.
- Test your changes. THIS IS IMPORTANT! Open the html file in your browser (by double clicking on it for example) and see what your card will look like on the site. See that the entire page still looks the same and nothing is broken. Click your links and make sure they are working. Open the console (Ctrl + Shift + J (Windows / Linux) or Cmd + Opt + J (Mac)) and check that there are no error messages.
- Great, you have finished editing your code! The next steps will send your changes to GitHub and then submit them to be merged with the main project.
- Go back to the GitHub desktop app.
- Your changes will have been added automatically to the staging area.
- This means that Git has recorded all the saved changes.
- You can see this reflected in the app. Everything you have added to the file will be in green, and deletions will show as red.
|
---|
|
---|
- Your changes are now saved or committed. But they are saved only locally, that is on your computer.
- Synchronizing local changes with your repository on Github is called a Push. You are "pushing" the changes from your local repository to the remote repository on Github.
|
---|
- After a few seconds the operation is complete and now you have exactly the same copy of this branch on your machine as well as on GitHub.
- This is the moment you have been waiting for; submitting a Pull Request (PR).
- So far all the work you have done has been on the fork of the project, which as you remember resides on your own account of GitHub.
- Now it's time to send your changes to the main project to be merged with it.
- This is called a Pull Request because you are asking the original project maintainer to "pull" your changes into their project.
- Go to the main page of your fork on GitHub (it will have the fork icon and your own user name at the top).
- Towards the top of the repo you will see a highlighted pull request message with a green button.
|
---|
|
---|
- Don't be fazed by all the options. You only need to do these three steps for now.
- Leave the option
Allow edits from maintainers
ticked. - Now, a Pull Request will be sent to the project maintainer. As soon as it is reviewed and accepted your changes will appear on the project web page.
That's it. You have done it! You have now contributed to open source on GitHub.
You have added code to a live web page: https://syknapse.github.io/Contribute-To-This-Project
Your changes won't be visible immediately; first they have to be reviewed, accepted, and merged by the project maintainer. Once they are merged your card should be visible and live on the page.
It is very normal for a reviewer to ask for changes on a PR. Think of it as good practice if it happens to you. Keep an eye for comments and requested changes. Once you make the requested changes (back in your branch) all you have to do is to commit and push your changes. The PR will automatically update with the new changes.
I promise I will try to review and merge as soon as possible but I do this in my spare time, so a few days delay is inevitable.
- Come back in a while to check for your merged Pull Request.
- You should receive an email from GitHub when your changes have been approved, or if additional changes are requested. And when the PR is finally merged with the master and your card has been added.
- If you found this project useful please give it a ⭐ star ⭐ at the top of the page and Tweet about it to help spread the word
- You can follow me and get in touch on Twitter or using any of these other options
- This is an open source project so apart from contributing your card you are welcome to help fix bugs, improvements, or new features. Open an issue or send a new pull request
- To help improve our community take a look at the Github Discussions tab located next to Pull Requests. This area is a place to introduce yourself, go into deeper discussions on Open Source, and communicate with the Project Maintainers. Will you help us build out this feature and enhance our community?
- Thanks for contributing to this project. Now you can go ahead and try contributing to other projects; look for the label for beginner-friendly contribution options.
- I'm also looking for collaborators to give me a hand in reviewing and merging PRs. If you would like to get more advanced Git practice please send me a DM on Twitter and read the maintainer's guide.
This project is heavily influenced by Roshan Jossey's great first-contributions project with its excellent tutorial.
It is also particularly inspired by the great community around #GoogleUdacityScholars The Google Challenge Scholarship: Front-End Web Dev, class of 2017 Europe.