/altschool-opensource-names

we are testing out open source contribution during our live class

Primary LanguageCSSMIT LicenseMIT

AltSchool Africa Logo AltSchool Africa Logo

Open Source Playground

Stars Badge Forks Badge Pull Requests Badge Issues Badge GitHub contributors

This project aims to introduce AltSchool Africa students to Open Source contribution. To get started, follow the steps below.

Fork this repository

This will create a local copy of the repository in your GitHub account

Screenshot of GitHub repository with the link to fork highlighted

Clone the repository

clone this repository

Now clone the forked repository to your machine. Go to your GitHub account, open the forked repository, click on the code button and then click the copy to clipboard icon.

Open a terminal and run the following git command:

git clone <url-you-copied>

where <url-you-copied> is the url to this repository (your fork of this project). See the previous steps to obtain the url.

For example:

git clone https://github.com/tobisupreme/altschool-opensource-names.git

Your GitHub username will be in place of tobisupreme. Here you're copying the contents of the altschool-opensource-names repository on GitHub to your computer.

Make a branch

Change into the repository directory on your computer (if you are not already there):

cd altschool-opensource-names

Keep a reference to the original project by entering the following command:

git remote add upstream https://github.com/Oluwasetemi/altschool-opensource-names.git

Create a new branch that describes the changes that you're going to make. For example, to create a branch named "adding-new-name", enter the following command:

git branch adding-new-name

Switch to the branch by entering git checkout <name-of-branch>. For our example, the command will be:

git checkout adding-new-name

Make changes and commit the changes

Now open names.txt file and add your name to it.

⚠️ Don't add it at the beginning or end of the file.

Put it anywhere in between (:pencil2: this will make the merge simple for git to understand).

Now, save the file.

While in the project directory, if you execute the command git status, you'll see there are changes.

git status in a terminal

Add those changes to the branch you just created using the git add command:

git add names.txt

Next, commit those changes using the git commit command:

git commit -m "Add <your-name> to the list of names"

replacing <your-name> with your name.

Push changes to GitHub

Push your changes using the command git push:

git push origin -u <your-branch-name>

replacing <your-branch-name> with the name of the branch you created earlier.

As per our example, the command will be:

git push -u origin adding-new-name

Submit your changes for review

Open your forked repository on GitHub. Click on the Compare & pull request button.

Screenshot of GitHub repository with the link to compare and pull request highlighted

Create a pull request

Screenshot of GitHub repository with the link to create pull request highlighted

And that's it! Your Pull Request has been submitted! 🥳 Soon a moderator will be merging all your changes into the main branch of this project. You will get a notification email once the changes have been merged.

Please read further if you have any conflicts or your pull request refuses to go through.

A note on resolving merge conflicts

Read the GitHub docs about resolving merge conflicts here.

To avoid fixing merge conflicts, all changes made will have to be discarded.

To get started, sync your forked repository by going to the GitHub page, then click the sync fork button.

Next, discard your commits.

Screenshot of GitHub repository with the link to sync fork highlighted

Then make a fresh clone of your newly synced repository and follow the steps from Clone the repository.

© AltSchool Africa