🦄 Making Your First Github Contribution

September 1, 2020

•

3 min read

Open Source is really great and it has a lot of advantages but many people find it difficult to contribute to open source. I am writing this as a simple guide to make your first contribution on github.

First Contributions is a github repository that is focused helping beginners to make thier first open source contribution. I will guide you through the steps.

You must have git installed on your computer.

Fork the Repository

Alt Text

Navigate to the firstcontributions/first-contributions repository and fork it. Forking a repository is creating an exact copy of the repository in your github account up to the latest git commit message.

Clone the repository

Alt Text

Click on the green code button and copy the clone link. On your computer with git installed, navigate to the directory you want to save the files and open your terminal in the directory.

git clone <the_link_you_copied>

# Example
git clone https://github.com/dephraiim/first-contributions.git
git clone <the_link_you_copied>

# Example
git clone https://github.com/dephraiim/first-contributions.git

Create a branch

To avoid any conflicts, create a branch to save all your changes then your branch will be merged. First change into the directory with the command below

cd first-contributions
cd first-contributions

Then create a branch with the checkout command

git checkout -b <your_new_branch_name>

# Example
git checkout -b add-duncan
git checkout -b <your_new_branch_name>

# Example
git checkout -b add-duncan

Make your Changes

Open the directory in your code editor. I like vim. Then make changes to the Contributors.md file.

Add your name at the end of the file with your github profile link then save the changes.

<!-- Example -->

- [Ephraim Atta-Duncan](https://github.com/dephraiim)
<!-- Example -->

- [Ephraim Atta-Duncan](https://github.com/dephraiim)

Commit your changes

After you save the changes, head back to the terminal to commit your changes. First, add the new changes to your branch with the add command

git add --all
git add --all

Then commit the change with the commit command.

git commit -m "Add <your_name> to Contributors list"

# Example
git commit -m "Add Ephraim Atta-Duncan to Contributors list"
git commit -m "Add <your_name> to Contributors list"

# Example
git commit -m "Add Ephraim Atta-Duncan to Contributors list"

Push your changes to Github.

Push your changes to your remote repository using the push command.

git push origin <your_branch_name>

# Example
git push origin add-duncan
git push origin <your_branch_name>

# Example
git push origin add-duncan

Open Pull Request

After the git push has completed, head to your repository and you'll see this.

Alt Text

Click on the Compare button to check if your branch can merge without conflicts. If there are no merge conflicts, click on the Create Pull Request button to create a new pull request. Alt Text

Now click on the Create Pull Request button to create a new Pull Request.

Alt Text

The repo has been linked to a bot so the pull request will be merged immediately

Alt Text

Congratulations 🎉, you just made your first contribution. The pull request will be merged very soon and you will get a notification email once the PR is merged.