Learning Pull Requests! - bounswe/bounswe2025group10 GitHub Wiki

πŸ“¦ Pull Requests (PR) – What They Are & How to Use Them

πŸ“š Index


πŸš€ Why Use Pull Requests?

  • βœ… Code Review: Enables teammates to review your changes before merging.
  • πŸ“œ History: Documents why and how changes were made.
  • πŸ”„ Collaboration: Enables discussion, suggestions, and improvements.
  • πŸ›‘οΈ Safety: Prevents direct edits to critical branches like main.

πŸ”§ How to Create a Pull Request

  1. Create a New Branch from main or another base:

    git checkout -b feature/your-feature-name
    
  2. Make your changes in the project, then commit them:

    git add .
    git commit -m "Add: meaningful description of the changes"
    
  3. Push your branch to the remote:

    git push origin feature/your-feature-name
    
  4. Go to GitHub β†’ Your Repository, and you’ll usually see a prompt:

    "Compare & pull request"

    Click it.

  5. Fill in the Pull Request form:

    • Title: Short, clear description of the feature or fix.
    • Description: What did you change? Why? How does it work?
    • Base branch: main
    • Compare branch: feature/your-feature-name
  6. Click "Create Pull Request"


πŸ” PR Review Process

Once the pull request is created:

  • Team members can review your changes.
  • They may approve, request changes, or comment on specific lines.
  • Once approved, the PR can be merged into the base branch by a team member (or you).

πŸ§ͺ Example Workflow

# Step 1: Create a new branch
git checkout -b feature/docker-setup

# Step 2: Make your changes

# Step 3: Commit changes
git add .
git commit -m "Add: Docker support for mobile development"

# Step 4: Push the branch
git push origin feature/docker-setup

# Step 5: Open GitHub and create a pull request from feature/docker-setup β†’ main

🏁 After Your PR is Merged

To keep your local main branch up to date:

git checkout main
git pull origin main

🧠 Extra Tip: Draft Pull Requests

If you're still working but want early feedback:

  • Click "Create draft pull request"
  • Reviewers will know it’s not ready to be merged yet, but they can comment and help you improve it.