← Back to Chapters

GitHub Send Pull Request

? GitHub Send Pull Request

? Quick Overview

A pull request (PR) is a way to propose changes to a repository. When you make changes in a forked or cloned repository, you can send a pull request to the original repository to suggest these changes. Pull requests allow collaboration and code review before merging changes.

? Key Concepts

  • Forked Repository
  • Feature Branch
  • Code Review
  • Merge Process

? What is a Pull Request?

A pull request is a method of submitting contributions to a project. Contributors request the repository owner to merge changes from their branch into the main project after review.

❓ Why Send a Pull Request?

  • Propose and explain changes
  • Enable structured code review
  • Track contributions
  • Encourage collaboration

⚙️ Syntax / Theory

? View Code Example
// Clone a forked repository from GitHub
git clone https://github.com/your-username/repository-name.git
? View Code Example
// Navigate into the project directory
cd repository-name
? View Code Example
// Create and switch to a new feature branch
git checkout -b feature/my-change

? Code Example(s)

? View Code Example
// Stage and commit your changes
git add .
git commit -m "Implemented new feature"
? View Code Example
// Push the branch to your GitHub fork
git push origin feature/my-change

? Live Output / Explanation

Once pushed, GitHub detects the new branch and prompts you to create a pull request. The changes are compared, reviewed, and can be merged once approved.

?️ Interactive Flow (Conceptual)

  • Fork → Clone → Branch
  • Edit → Commit → Push
  • Create PR → Review → Merge

? Use Cases

  • Open-source contributions
  • Team-based development
  • Bug fixes and enhancements
  • Code review workflows

? Tips & Best Practices

  • Keep pull requests small and focused
  • Write clear commit messages
  • Sync with upstream regularly
  • Respond politely to review comments

? Try It Yourself

  • Fork any public repository
  • Create a feature branch and edit a file
  • Push changes and open a pull request