Falytom logoFALYTOM
Games
ToolsUI ComponentsServicesProductsAbout
menu
  1. Home
  2. /Web Development
  3. /Github
  4. /Forking Pull Requests
Your Progress0%
0 of 20 completed

Git & Github Topics

Getting Started

  • What is Git?
  • What is GitHub?
  • Installing & Configuring Git
  • Your First Git Repository

Core Git Concepts

  • Understanding Commits & History
  • Working with Branches
  • Merging Branches
  • The Staging Area
  • Undoing Changes

Working with GitHub

  • Connecting to GitHub
  • Pushing & Pulling Code
  • Cloning Repositories
  • GitHub README & Documentation

Collaboration Workflows

  • Forking & Pull Requests
  • Code Review Basics
  • Handling Merge Conflicts
  • Issues & Project Management

Best Practices & Workflows

  • Git Workflow Best Practices
  • Working with .gitignore
  • Common Git Problems & Solutions

Forking & Pull Requests

Contribute to projects through forks and pull requests

Pull Requests are the heart of collaboration on GitHub. They're how you propose changes to projects you don't own, how teams review code before merging, and how the open source world functions. In this lesson, you'll master the complete fork and pull request workflow—from forking a repository and making changes, to creating a professional PR, responding to feedback, and getting your code merged. By the end, you'll be ready to contribute to any project on GitHub!

What Are Pull Requests?

A Pull Request (PR) is a proposal to merge changes from one branch into another. It's called a "pull" request because you're asking the maintainers to pull your changes into their repository.

Pull Request Flow:

  1. You make changes in a branch
  2. You open a Pull Request proposing those changes
  3. Others review your code and discuss it
  4. You make any requested changes
  5. Maintainers approve and merge your PR
  6. Your changes are now part of the project!

Why Pull Requests?

  • Code review: Others can review and improve your code before it's merged
  • Discussion: Talk about implementation decisions
  • Testing: Many projects run automated tests on PRs
  • Documentation: PRs create a record of what changed and why
  • Quality control: Prevents direct commits to main branches
  • Learning: Great way to learn from feedback

🤝 Not Just for Open Source

Pull Requests aren't just for contributing to other people's projects. Many teams use PRs internally—even when everyone has write access—because code review improves quality!

The Fork and Pull Request Workflow

Here's the complete workflow for contributing to a project you don't own:

TEXT
Original Repo → Fork (your copy) → Clone locally → Branch → Changes → Push → Pull Request
  (GitHub)        (GitHub)           (Your PC)      (Git)    (Code)   (Git)    (GitHub)

Let's walk through each step in detail.

Step-by-Step: Your First Pull Request

Step 1: Find a Project to Contribute To

For this tutorial, let's say you want to contribute to a project called awesome-project at github.com/maintainer/awesome-project.

🔍 Finding Good First Issues

Look for repositories with labels like:

  • good first issue
  • beginner friendly
  • help wanted
  • documentation

These are issues specifically marked as good for newcomers!

Step 2: Fork the Repository

  1. Go to github.com/maintainer/awesome-project
  2. Click the "Fork" button (top-right)
  3. GitHub creates a copy in your account: github.com/yourname/awesome-project

You now have your own copy! You can push to this fork freely—it's yours.

Step 3: Clone Your Fork

BASH
# Clone YOUR fork (not the original)
git clone https://github.com/yourname/awesome-project.git

# Navigate into it
cd awesome-project

Step 4: Add Upstream Remote

Add the original repository as "upstream" so you can get updates:

BASH
# Add the original repo as 'upstream'
git remote add upstream https://github.com/maintainer/awesome-project.git

# Verify your remotes
git remote -v

# You should see:
# origin    https://github.com/yourname/awesome-project.git (fetch)
# origin    https://github.com/yourname/awesome-project.git (push)
# upstream  https://github.com/maintainer/awesome-project.git (fetch)
# upstream  https://github.com/maintainer/awesome-project.git (push)

Step 5: Create a Feature Branch

Never work directly on main. Create a descriptive branch:

BASH
# Update main first
git checkout main
git pull upstream main

# Create feature branch
git checkout -b fix-typo-in-readme

# Or for a feature
git checkout -b add-dark-mode-toggle

🏷️ Branch Naming Conventions

Use clear, descriptive names:

  • fix-login-bug
  • add-search-feature
  • update-dependencies
  • docs-improve-readme

Avoid vague names like patch-1 or temp.

Step 6: Make Your Changes

Edit files, write code, add features, fix bugs—whatever you're contributing:

BASH
# Make your changes
# ... edit files ...

# Check what changed
git status
git diff

# Stage and commit
git add .
git commit -m "Fix typo in installation instructions"

# Make more changes if needed
git commit -am "Add screenshot showing fixed section"

Step 7: Push to Your Fork

BASH
# Push your branch to YOUR fork
git push origin fix-typo-in-readme

# If first push, may need:
git push -u origin fix-typo-in-readme

Step 8: Create the Pull Request

  1. Go to your fork on GitHub: github.com/yourname/awesome-project
  2. You'll see a yellow banner saying "Compare & pull request"
  3. Click "Compare & pull request"
  4. You'll see a form with:
    • Title: Summary of your changes
    • Description: Details about what you changed and why
    • Base repository: Where you want to merge TO (the original)
    • Base branch: Usually main
    • Head repository: Your fork
    • Compare branch: Your feature branch
  5. Fill in a good title and description
  6. Click "Create pull request"

Congratulations! You've created your first Pull Request! The project maintainers will be notified and can review your changes.

Writing a Great PR Description

A good PR description helps reviewers understand your changes quickly.

Good PR Template

MARKDOWN
## Summary
Brief description of what this PR does.

## Motivation
Why is this change needed? What problem does it solve?

## Changes Made
- Added X feature
- Fixed Y bug
- Updated Z documentation

## How to Test
1. Step 1
2. Step 2
3. Expected result

## Screenshots (if applicable)
![Before](before.png)
![After](after.png)

## Checklist
- [x] Tests pass
- [x] Documentation updated
- [x] No breaking changes
- [ ] Need feedback on approach

## Related Issues
Fixes #123
Related to #456

PR Title Best Practices

Good PR Titles:

  • Fix: Resolve login redirect issue on mobile devices
  • Feature: Add dark mode toggle to settings page
  • Docs: Update installation guide for Windows users
  • Refactor: Simplify authentication logic

Bad PR Titles:

  • Update
  • Fix stuff
  • Patch
  • Changes

📋 Many Projects Have Templates

Many repositories have PR templates that GitHub shows automatically. Fill them out completely—they're there to help you provide all the necessary information!

The PR Review Cycle

After creating your PR, here's what typically happens:

1. Automated Checks

Many projects run automated tests and checks on your PR:

  • CI/CD tests: Unit tests, integration tests
  • Linting: Code style checks
  • Build verification: Ensure code compiles
  • Security scans: Check for vulnerabilities

If checks fail, you'll see red X marks. Click them to see what went wrong.

2. Code Review

Maintainers and other contributors will review your code:

  • Comments: Questions or suggestions on specific lines
  • General feedback: Overall thoughts
  • Requested changes: Things that must be fixed
  • Approval: Code looks good!

3. Addressing Feedback

Respond to comments and make requested changes:

BASH
# Make the requested changes
# ... edit files ...

# Commit the changes
git add .
git commit -m "Address review feedback: improve error handling"

# Push to the same branch
git push origin fix-typo-in-readme

# The PR automatically updates!

Important: When you push new commits to your branch, they automatically appear in the PR. You don't need to create a new PR!

4. Discussion and Iteration

You might go through several rounds of:

  • Feedback → Changes → More feedback
  • This is normal and healthy!
  • Be patient and responsive
  • Don't take feedback personally

5. Approval and Merge

Once reviewers approve:

  • Maintainer clicks "Merge pull request"
  • Your changes are merged into the main repository!
  • Your contribution is now part of the project
  • You might be listed as a contributor

6. After Merge

BASH
# Update your fork's main branch
git checkout main
git pull upstream main
git push origin main

# Delete your feature branch locally
git branch -d fix-typo-in-readme

# Delete it on GitHub
git push origin --delete fix-typo-in-readme

Responding to PR Feedback

Types of Feedback

1. Questions

Reviewer asks: "Why did you choose this approach?"

Good response: Explain your reasoning clearly and consider alternatives they might suggest.

2. Suggestions

Reviewer suggests: "Consider using Array.map() instead of a for loop here"

Good response: Either implement the suggestion or explain why your approach is better.

3. Required Changes

Reviewer requests: "Please add error handling here"

Good response: Make the change, push it, and comment that you've addressed it.

How to Respond Professionally

Do:

  • Thank reviewers for their time
  • Ask clarifying questions if needed
  • Be open to suggestions
  • Explain your decisions respectfully
  • Mark conversations as resolved when addressed
  • Push changes promptly

Don't:

  • Take feedback personally
  • Get defensive or argumentative
  • Ignore feedback
  • Make changes without commenting
  • Force your way over reasonable objections

Example Responses

MARKDOWN
Good response to feedback:
"Thanks for the suggestion! I've updated the code to use Array.map() as you recommended. It's much cleaner this way. Let me know if you'd like any other changes!"

Good response to disagreement:
"I see your point about using a library here. I chose to implement it manually because:
1. It reduces dependencies
2. We only need this one feature
3. The implementation is straightforward

What do you think? I'm happy to reconsider if you feel the library is still better."

Good response to question:
"Great question! I used this approach because the API documentation recommends it for rate-limited endpoints. Here's the link: [url]. However, if there's a better way, I'm all ears!"

Keeping Your Fork Updated

The original repository changes while you're working. Keep your fork synchronized:

Regular Sync Routine

BASH
# Switch to main
git checkout main

# Fetch from upstream
git fetch upstream

# Merge upstream changes
git merge upstream/main

# Push to your fork
git push origin main

Update Your Feature Branch

If the main branch changed while you were working:

BASH
# Update main first
git checkout main
git pull upstream main

# Switch to your feature branch
git checkout fix-typo-in-readme

# Merge main into your branch
git merge main

# Or rebase (cleaner history)
git rebase main

# Push updated branch
git push origin fix-typo-in-readme --force-with-lease

When to sync:

  • Before starting new work
  • When reviewers request you update your branch
  • If your PR shows conflicts
  • Regularly during long-running work

Draft Pull Requests

GitHub lets you create Draft Pull Requests for work-in-progress:

When to Use Drafts

  • Get early feedback on your approach
  • Show progress on long-running features
  • Discuss design decisions before finishing
  • Signal that code isn't ready for full review

Creating a Draft PR

  1. When creating the PR, click the dropdown on the button
  2. Select "Create draft pull request"
  3. When ready, click "Ready for review" to convert to a normal PR

🚧 Label Your Draft PRs

Add [WIP] or [DRAFT] to the title so it's extra clear:

[WIP] Add dark mode toggle - need feedback on approach

Pull Request Etiquette

Before Creating a PR

  • Read CONTRIBUTING.md: Follow project guidelines
  • Check existing PRs: Make sure someone isn't already working on it
  • Test your changes: Ensure everything works
  • Follow code style: Match the project's style
  • Keep it focused: One PR = one feature/fix

While PR is Open

  • Respond promptly: Don't ghost reviewers
  • Be patient: Maintainers are often volunteers
  • Stay engaged: Participate in discussion
  • Don't force merge: Wait for approval

What Makes a Good PR

  • Small and focused: Easy to review
  • Well tested: Actually works
  • Clear description: Explains what and why
  • Good commits: Meaningful commit messages
  • Follows guidelines: Matches project conventions
  • Updated documentation: If needed
  • Responsive author: Addresses feedback quickly

Practice Fork/PR Commands

Try these commands to practice the fork workflow:

Practice Fork and PR Workflow

Experiment with upstream and fork management

$

Try these examples:

Troubleshooting PRs

Issue: PR Shows Conflicts

Problem: "This branch has conflicts that must be resolved"

Solution:

BASH
# Update main
git checkout main
git pull upstream main

# Switch to your branch
git checkout your-branch

# Merge main into your branch
git merge main

# Resolve conflicts (we'll learn this in detail next lesson)
# Then:
git add .
git commit
git push origin your-branch

Issue: Pushed to Wrong Branch

Problem: Committed to main instead of feature branch

Solution:

BASH
# Create branch from current commit
git branch fix-feature

# Reset main
git checkout main
git reset --hard upstream/main

# Switch to fix branch
git checkout fix-feature
git push -u origin fix-feature

Issue: Want to Change PR Branch

Problem: Need to target different branch

Solution: Click "Edit" button next to PR title, change base branch in dropdown

Command Reference

Here's a quick reference for the fork workflow:

BASH
# Initial Setup
git clone https://github.com/yourname/repo.git
git remote add upstream https://github.com/original/repo.git
git remote -v

# Starting New Work
git checkout main
git pull upstream main
git push origin main
git checkout -b feature-name

# Making Changes
git add .
git commit -m "Description of changes"
git push -u origin feature-name

# Syncing with Upstream
git fetch upstream
git checkout main
git merge upstream/main
git push origin main

# Updating Your PR Branch
git checkout feature-name
git merge main  # or: git rebase main
git push origin feature-name

# After PR is Merged
git checkout main
git pull upstream main
git push origin main
git branch -d feature-name
git push origin --delete feature-name

Key Takeaways

  • Pull Requests are proposals to merge changes from one branch to another
  • Fork a repository to create your own copy you can push to
  • Add the original repository as upstream remote
  • Always work on feature branches, never directly on main
  • Write clear PR descriptions explaining what and why
  • Respond professionally and promptly to review feedback
  • Keep your fork synced with the upstream repository
  • Use draft PRs for work-in-progress to get early feedback
  • Small, focused PRs are easier to review and more likely to be merged
  • After PR is merged, update your fork and delete the feature branch

What's Next?

Excellent work! You now understand the complete fork and pull request workflow. You can contribute to any project on GitHub—from small open source tools to major frameworks!

In the next lesson, we'll explore Code Review Basics. You'll learn how to review other people's pull requests, give constructive feedback, understand what to look for during reviews, and become a better collaborator. Code review is a critical skill that improves both your own code and your ability to help others!

🎯 Practice Assignment

Before the next lesson, make your first real contribution:

  1. Find a repository with good first issue label
  2. Fork the repository and clone your fork
  3. Add the upstream remote
  4. Create a feature branch and make your contribution
  5. Write a clear PR description
  6. Submit your pull request!
  7. Respond professionally to any feedback you receive

Don't be nervous—everyone's first PR is a learning experience. The open source community is generally welcoming to newcomers!

Test Your Understanding of Forking & Pull Requests

Question 1 of 4

What is a Pull Request?

Current Score0 / 0

Know someone who'd find this guide helpful? Please share!

Previous
GitHub README & Documentation
Next
Code Review Basics

Never Miss a New Git & GitHub Tutorial

Join 2,000+ developers learning Git & GitHub step-by-step. Get new tutorials, tips, and exclusive resources delivered to your inbox - completely FREE.

You might also like

UI Components

Ready-made components for your projects

Developer Tools

Boost productivity with handy generators

HTML Game

Learn HTML concepts through interactive gameplay

Join Our Web Development Training Program

Master frontend & backend development with hands-on projects.

Git & Github Tutorials

0 of 20 completed

Your Progress0%

Topics

Getting Started

  • What is Git?
  • What is GitHub?
  • Installing & Configuring Git
  • Your First Git Repository

Core Git Concepts

  • Understanding Commits & History
  • Working with Branches
  • Merging Branches
  • The Staging Area
  • Undoing Changes

Working with GitHub

  • Connecting to GitHub
  • Pushing & Pulling Code
  • Cloning Repositories
  • GitHub README & Documentation

Collaboration Workflows

  • Forking & Pull Requests
  • Code Review Basics
  • Handling Merge Conflicts
  • Issues & Project Management

Best Practices & Workflows

  • Git Workflow Best Practices
  • Working with .gitignore
  • Common Git Problems & Solutions
Falytom logoFALYTOM

Learn technologies like HTML, CSS, JavaScript, React, NodeJS and more through interactive games, tutorials, components and free tools. Transform your businesses with AI chatbots, SEO-optimized websites, and professional development services.

© 2025 Tomilola Group
  • Facebook logo
  • Twitter logo
  • Instagram logo
  • LinkedIn logo
  • GitHub logo
  • YouTube logo