This guestbook is a place for people who have taken OpenSauced's Intro to Open Source course to take their first steps into contributing to open source.
First, you'll want to have Node.js installed. You can do this by going to nodejs.org and downloading the latest version. Then, follow these steps:
-
Fork this repository.
-
Clone your forked repository to your computer.
-
Run
npm install
to install the dependencies. -
Create a new branch.
The best practice for open-source contributors to work on changes is in a new branch to isolate them from the
main
branch.Run this command on your terminal to create a new branch. You can name the branch anything you want.
git checkout -b branch-name
-
Add yourself to the guestbook.
There are two ways you can complete this activity:
- Using the CLI tool.
- Manually editing the
.all-contributorsrc
file
Although adding yourself to the guestbook with the CLI tool is simpler, we recommend you to manually editing the file to get more experience adding and committing your changes, creating pull requests and pull request reviews. Below, you'll find the directions for each method:
CLI Tool
-
Run
npm run contributors:add
in your terminal.Follow the instructions to add yourself to the guestbook. After you finish and click enter, you must click enter again to confirm your choices.
Manual Addition
-
Open the
.all-contributorsrc
file. -
Go to the last contributor in the contributors array.
-
Add a comma after the last closing curly bracket (
},
). -
Copy and paste the template below:
{ "login": "", "name": "", "avatar_url": "", "profile": "", "contributions": [] }
-
Add yourself manually to the guestbook by updating this information:
-
login: Your GitHub's username.
-
name: Your name.
-
avatar_url: URL to your avatar on GitHub.
In your browser, copy and paste the link of your GitHub profile, append
.png
at the end β for example,https://github.com/USER_NAME.png
β and click enter. Copy and paste the link here. -
profile: Link to your website (if you include it in your GitHub profile) or your GitHub profile.
-
contribution: Type of your contributions.
Refer to the type (in the first column) in this emoji key and contribution types to fill this value.
The result would be like this:
{ "login": "github-username", "name": "User Name", "avatar_url": "https://avatars.githubusercontent.com/u/xxxxxxxx?v=x", "profile": "URL link", "contributions": [ "question", "blog", "code" ] }
Remember to add a comma after the quotes, except for the last one in the array and the last closing curly bracket.
-
-
Run
npm run contributors:generate
in your terminal to generate the guestbook on the README. -
If you used the CLI tool method in step 5, to add yourself to the guestbook, skip this step; otherwise: Add and commit your changes by running this command:
git commit -am "Your message"
Change
"Your message"
to your own message. For example,"Add Alice to the guestbook"
. -
Run
git log
to check if you have committed your changes. PressQ
to close the log.If you add yourself using the CLI tool, it automatically adds and commits your changes. So you will see this automated commit message:
docs: add @your_username as a contributor
-
Push the commit to your forked repository with this command:
git push -u origin branch-name
-
Go to your forked repository on GitHub and create a pull request with the title
feat: add {GitHub username} as a contributor
.
Merge conflicts are something you'll commonly encounter when contributing to an open source project. They usually occur when there are changes on the same line(s) in the same file(s) from two different branches.
Since the main purpose of the guestbook is to add your name to .all-contributorsrc
and the README.md
files, there is a high chance that you will encounter merge conflicts that you need to resolve before your pull request (PR) can be merged. It happens when maintainers have merged PRs before yours while you're working on your changes or waiting for your PR to be reviewed.
In this section, we will walk you through how to keep your branch up to date and how to resolve conflicts for this project.
Before resolving conflicts, your branch has to be in sync with the latest changes in the main
branch of the original (upstream
) repository.
First, you must update your forked (origin
) repository:
- Go to your forked repository on GitHub.
- Click the "Sync fork" button.
- Click the green "Update branch" button.
Then, pull the latest changes in the main
branch in the origin
repository to your local working branch by following these steps in your terminal:
-
Go to your working branch.
git checkout <your-branch-name>
-
Pull the latest changes with this command:
git pull origin main
Follow these steps to resolve the merge conflicts:
-
In the
.all-contributorsrc
file:- Click the "Accept Both Change" option on the top of your workspace in VSCode.
- Move your profile details to the end of the contributors array and fix anything necessary.
-
In the
README.md
file:- Click the "Accept Incoming Change" option on the top of your workspace in VSCode for each conflict in this file.
-
Run
npm run contributors:generate
.You will now see that the all contributors badge has been incremented, and your profile is generated at the end of the contributors list in the
README.md
file. -
Add and commit your changes.
git commit -am "Resolve merge conflicts"
-
Push your commits to your remote branch.
git push
Congratulations on your first contribution! π
You can add this contribution to your OpenSauced resume and profile as outlined in the course.
Hungry for more contributions? Check out our pizza verse repository and join us in celebrating pizza!ππ
All contributors are required to abide by our Code of Conduct. Please follow the Readme directions for contributing.
If you are interested in contributing to improving of this course, please create an issue and refer to this guide
- Translations: If you want to translate the README and other necessary parts of this repo, check out our community guidelines.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind are welcome!