First off, thank you for considering contributing to FaucETH! It's people like you that make FaucETH such a great project.
Here's a summary of the workflow for contributors:
- Fork and Clone: Fork the repository on GitHub, then clone your fork locally.
- Configure Upstream: Add the original FaucETH repository as an
upstreamremote. This helps you keep your fork in sync. - Create a Branch: Create a new branch for your feature or bugfix.
- Develop: Make your code changes.
- Commit: Commit your changes with a clear message.
- Sync and Rebase: Before pushing, sync your
mainbranch with the upstream repository and rebase your feature branch on top of the latest changes. - Push: Push your branch to your fork on GitHub.
- Open a Pull Request: Create a Pull Request from your branch to the
mainbranch of the original FaucETH repository.
First, fork FaucETH on GitHub.
Then, clone your fork to your local machine:
git clone git@github.com:YOUR_USERNAME/fauceth.git
cd faucethAdd the original repository as an upstream remote. This is a one-time setup.
git remote add upstream https://github.com/ajayimike/fauceth.gitYou can verify that the remote was added by running:
git remote -vThis will show you two remotes:
originpoints to your personal fork of the repository on GitHub.upstreampoints to the originalajayimike/faucethrepository.
You will push your changes to origin and pull updates from upstream.
Before you start coding, create a new branch based on the main branch. Use a descriptive name. If you are working on an issue, include the issue number.
# Make sure you are on the main branch and it's up to date
git checkout main
git pull upstream main
# Create your new branch (e.g. for issue #38)
git checkout -b feat/38/add-awesome-featureThe README.md has instructions on how to get the project running. At this point, you're ready to make your changes! Feel free to ask for help; everyone is a beginner at first 😸
This project uses Prettier to enforce a consistent code style. You don't need to run any commands manually. Your code will be automatically formatted for you before each commit thanks to a pre-commit hook.
If you use VS Code, we highly recommend installing the Prettier extension. The project is already configured to use it to format your code automatically every time you save a file.
Once you're happy with your changes, stage and commit them.
git add .
git commit -m "feat: add awesome feature"Please write a clear and concise commit message.
Before you push your changes, it's important to sync your branch with the latest changes from the main project. This is especially important if you have a long-running branch.
# Switch to your main branch and pull the latest changes
git checkout main
git pull upstream main
# Switch back to your feature branch
git checkout feat/38/add-awesome-feature
# Rebase your branch onto the latest main
# This applies your commits on top of the latest changes
git rebase mainYou may need to resolve merge conflicts during the rebase.
Push your rebased branch to your fork on GitHub.
# You may need to force push because of the rebase
git push origin feat/38/add-awesome-feature --force-with-leaseNote on Pre-push Checks: Before your code is pushed, a pre-push hook will automatically run to build the project. This is to ensure that no broken code is pushed to the repository. If the build fails, your push will be aborted. You'll need to fix the build errors before you can push successfully.
A Note on Force Pushing: We use git rebase to keep the commit history clean. Rebasing rewrites your branch's history, so you must use a force push to update the branch on your fork.
We specifically recommend --force-with-lease because it is safer than a standard --force. It will not overwrite any work on the remote branch if someone else has pushed to it since you last fetched, thereby preventing accidental data loss.
Go to your fork on GitHub. You should see a prompt to create a pull request from your new branch. Follow the link, fill out the pull request template, and submit it.
That's it! Thank you for your contribution.
Thanks!