Welcome, contributor! This guide provides a detailed walkthrough of our development workflow using Git and GitHub. Following these steps will ensure a smooth and effective process for everyone.
Before you start coding, you need to get the project on your local machine.
-
Fork the Repository
- Click the Fork button on the top-right of the repository page on GitHub. This creates your own copy of the project.
-
Clone Your Fork
- Clone your forked repository to your computer. Replace
[YOUR-USERNAME]with your actual GitHub username.
git clone [https://github.com/](https://github.com/)[YOUR-USERNAME]/[PROJECT-NAME].git
- Clone your forked repository to your computer. Replace
-
Navigate to the Project Directory
cd [PROJECT-NAME]
Always work on a new branch for every contribution. This keeps the main branch clean and makes it easier to manage changes.
-
Create a New Branch
- Create a branch from the
mainbranch and switch to it.
git checkout -b <your-new-branch-name>
- Create a branch from the
-
Branch Naming Conventions
- Using a consistent naming convention helps us understand the purpose of a branch at a glance. Please use the following formats:
- Features:
feat/short-feature-description(e.g.,feat/add-user-login) - Bug Fixes:
fix/short-bug-description(e.g.,fix/navbar-alignment-issue) - Documentation:
docs/topic-of-docs(e.g.,docs/update-contribution-guide) - Refactoring:
refactor/area-of-refactor(e.g.,refactor/simplify-api-calls)
- Features:
- Using a consistent naming convention helps us understand the purpose of a branch at a glance. Please use the following formats:
This is the core development loop: code, stage, commit.
-
Make Your Changes
- Write your code, fix the bug, or improve the documentation.
-
Stage Your Changes
- Add the files you've changed to the staging area.
# Stage all changes git add . # Or stage a specific file git add path/to/your/file.js
-
Commit Your Changes
- Commit your staged changes with a descriptive message that follows the Conventional Commits standard.
- A good commit message is crucial for understanding the project's history.
Commit Message Structure:
type: subjectExamples:
git commit -m "feat: Implement user profile page" git commit -m "fix: Resolve off-by-one error in pagination" git commit -m "docs: Add details about API endpoints to README"
Once you've committed your changes, push your branch to your forked repository on GitHub.
- Push the Branch
- The
-uflag sets the upstream link, so for future pushes from this branch, you can simply usegit push.
git push -u origin <your-new-branch-name>
- The
The final step is to propose your changes to the main project by creating a Pull Request.
- Go to your forked repository on GitHub.
- You will see a prompt to "Compare & pull request". Click it.
- Write a Clear Title and Description:
- The title should be concise and follow the conventional commit format (e.g.,
feat: Add dark mode toggle). - The description should explain what you changed and why.
- The title should be concise and follow the conventional commit format (e.g.,
- Link to the Issue:
- If your PR fixes an existing issue, add
Closes #[ISSUE-NUMBER]to the description. This will automatically close the issue when the PR is merged.
- If your PR fixes an existing issue, add
- Click "Create pull request". A project maintainer will review your work, provide feedback if needed, and merge it once it's approved.
Here are all the commands in one place for quick reference.
# 1. Clone your fork
git clone [https://github.com/](https://github.com/)[YOUR-USERNAME]/[PROJECT-NAME].git
cd [PROJECT-NAME]
# 2. Create a new branch
git checkout -b feat/my-new-feature
# 3. Make changes, then stage and commit them
git add .
git commit -m "feat: Add my new feature"
# 4. Push your branch to your fork
git push -u origin feat/my-new-feature