- How to contribute?
- Contribution approved, what to do?
- Synchronizing the fork/clone with the official repository
- Useful links
To make contributions, make sure you have git installed in your environment.
With git already installed, follow the steps below.
Fork the repository to your account by clicking the fork button:
You will be redirected to your account once the process is complete.
Once you have the repository in your account, clone it in your local environment:
$ git clone https://github.com/<YOUR_ACCOUNT_NAME>/<REPOSITORY_NAME>.git
With the clone in your environment, link the local repository to the remote Coding in Community organization:
$ git remote add upstream https://github.com/Coding-in-community/<REPOSITORY_NAME>.git
This will serve to sync updates made in the official repository to your local environment.
OBS: This command is only necessary to run once after cloning.
To check if everything went right, run the command below in the terminal:
$ git remote --v
If everything went well, there should be an output similar to this:
origin https://github.com/<YOUR_ACCOUNT_NAME>/<REPOSITORY_NAME>.git (fetch)
origin https://github.com/<YOUR_ACCOUNT_NAME>/<REPOSITORY_NAME>.git (push)
upstream https://github.com/Coding-in-community/<REPOSITORY_NAME>.git (fetch)
upstream https://github.com/Coding-in-community/<REPOSITORY_NAME>.git (push)
Create a branch to make your contribution:
$ git checkout -b feature/feature_name
Now add your contributions to the project.
Add your contributions:
$ git add example_file.js
OBS: Add all files/directories created and/or modified
Now commit:
$ git commit -m "Contribution Description"
After completing your contribution, send it to the remote repository in your account:
$ git push origin feature/feature_name
In your github account, submit a Pull Request with your contribution to the official repository:
Now wait for the review from one of the project's maintainers.
After an approved pull request, if you don't want to contribute again, you can either delete the branch you used to contribute on the Pull Request page itself or delete the fork from your account.
If you want to make other contributions that are unrelated to the branch of the old contribution, delete the old one and create a new one.
Go to the default branch:
$ git checkout master
Delete the old one:
$ git branch -d name_of_old_branch
Now create a new branch and repeat the steps 4º Step, 5º Step, 6º Step and 7º Step
To synchronize the fork/clone with the new features you have in the official repository follow the steps below:
Make sure you're on the default branch, which commonly is master
:
$ git checkout master
Now, sync with:
$ git pull upstream master
After that, the local environment is synchronized.
Now that the local environment is synchronized, synchronize the remote too:
$ git push origin master
Ready, local and remote environment synchronized with the official.
If you have any questions about a command used or just want to understand better, see one of the links below: