This project aims to introduce AltSchool Africa students to Open Source contribution. To get started, follow the steps below.
This will create a local copy of the repository in your GitHub account
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.
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
Now open names.txt
file and add your name to it.
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.
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 your changes using the command git push
:
git push origin -u <your-branch-name>
replacing <add-your-branch-name>
with the name of the branch you created earlier.
As per our example, the command will be:
git push origin -u adding-new-name
Open your forked repository on GitHub. Click on the Compare & pull request
button.
Create a pull request
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.
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.
Then make a fresh clone of your newly synced repository and follow the steps from Clone the repository.