Step by step, you can make your first Contribution to Github

Let Roshan Jossey take you 10 minutes to contribute to your first open source project.

Next Stop, GitHub. Image via unsplash.com

preface

If you don’t have a GitHub account or don’t know what Git is, read: New Developer? You should have learned Git long ago.

Meet our teachers

Hopefully, you already have a GitHub account, so start contributing your first open source project!

I know, as a new developer, contributing to a project seems a little weird, even though I felt that way at the time. It took me a long time to complete my first Pull Request. That’s why I wanted to read Roshan Jossey. Roshan Created First Contributions — a GitHub repository that teaches beginners the steps of contributing and also provides a repository for you to use to contribute your First project.

Start your first open source contribution

If you don’t speak English, there are up to 13 languages to choose from: Spanish, Dutch, Hindi, Russian, Japanese, Vietnamese, Polish, Korean, German, Simplified Chinese, Traditional Chinese, Greek, an ل ع ر ب ي ة.


1. Fork a warehouse

First Contributions Fork a warehouse by clicking the Fork button on the right side of the page. This will copy a repository into your account.

2. Clone the warehouse

Now let’s clone the project locally. Click the clone button and then click the Copy to Clipboard icon.

Open a command line tool and run the following command:

`git clone "url you just copied"`
Copy the code

Here ‘URL you just copied’ (no colons needed on the command line) is the warehouse address First Contributions. Fill in the address obtained in the previous step.

Such as:

`git clone [https://github.com/this-is-you/first-contributions.git](https://github.com/this-is-you/first-contributions.git)`
Copy the code

This -is-you here is your GitHub account. Copy your first-contributions for this project onto your computer.

3. Create a branch

Change a repository folder on your computer (if you’re not there yet):

`cd first-contributions`
Copy the code

Create a branch using git checkout:

`git checkout -b <add-your-name>`
Copy the code

Such as:

`git checkout -b add-alonzo-church`
Copy the code

(The word “add” is not required for branch names, but there is one case where you can add your name.)

4. Make some changes and submit

Go to the ficol.md file with an editor, add your name and save. Execute Git status in this directory and you’ll notice the change. To add the changed file to your branch, simply run the git add command:

`git add Contributors.md`
Copy the code

Git commit

`git commit -m "Add <your-name> to Contributors list"`
Copy the code

Replace with your name

5. Push changes to GitHub

Git push:

`git push origin <add-your-name>`
Copy the code

Replace the name of the branch you created earlier

6. Review the changes you submitted

Go to the GitHub project home page and you’ll see a Compare & Pull Request button. Click on it.

Submit your submission request now.

I will soon merge all changes into the main branch of the project, and you will receive a notification email once the changes are merged. There will be no changes to the main branch of your project in order to keep pace with my project

The master branch of your fork won’t have The changes. In order to keep your fork synchronized with mine, read on.

7. Keep your fork in sync with the repository

First, switch the main branch

`git checkout master`
Copy the code

Upstream remote URL:

`git remote add upstream [https://github.com/Roshanjossey/first-contributions](https://github.com/Roshanjossey/first-contributions)`
Copy the code

This is a way of telling git that another version of this project exists in the specified url and we’re calling it upstream. Once the changes are merged, fetch the new version of my repository:

`git fetch upstream`
Copy the code

Here we’re fetching all the changes in my fork (upstream remote). Now, you need to merge the new revision of my repository into your master branch.

`git rebase upstream/master`
Copy the code

Here you’re touchall the changes you could make to master Branch. If you push the master Branch now, your fork will also have the changes:

`git push origin master`
Copy the code

Notice here you’re pushing to the remote named origin.

At this point I have merged your branch “ into my master branch, and you have merged my master branch into your own master branch. Your branch is now no longer needed, so you may delete it:

`git branch -d <add-your-name>`
Copy the code

Also you can delete your remote repository

`git push origin --delete <add-your-name>`
Copy the code

It is not necessary, but the name of this branch shows its rather special purpose. Its life can be made intermediate short.