Skip to content

Latest commit

 

History

History
124 lines (87 loc) · 4.15 KB

File metadata and controls

124 lines (87 loc) · 4.15 KB

Step-by-Step Contribution Guide

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.


Step 1: Set Up Your Local Environment

Before you start coding, you need to get the project on your local machine.

  1. 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.
  2. 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
  3. Navigate to the Project Directory

    cd [PROJECT-NAME]

Step 2: Branching Strategy

Always work on a new branch for every contribution. This keeps the main branch clean and makes it easier to manage changes.

  1. Create a New Branch

    • Create a branch from the main branch and switch to it.
    git checkout -b <your-new-branch-name>
  2. 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)

Step 3: Make and Commit Your Changes

This is the core development loop: code, stage, commit.

  1. Make Your Changes

    • Write your code, fix the bug, or improve the documentation.
  2. 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
  3. 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: subject

    Examples:

    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"

Step 4: Push Changes to Your Fork

Once you've committed your changes, push your branch to your forked repository on GitHub.

  1. Push the Branch
    • The -u flag sets the upstream link, so for future pushes from this branch, you can simply use git push.
    git push -u origin <your-new-branch-name>

Step 5: Create a Pull Request (PR)

The final step is to propose your changes to the main project by creating a Pull Request.

  1. Go to your forked repository on GitHub.
  2. You will see a prompt to "Compare & pull request". Click it.
  3. 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.
  4. 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.
  5. Click "Create pull request". A project maintainer will review your work, provide feedback if needed, and merge it once it's approved.

Quick Command Cheatsheet

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