Course contentsShow
← Git & GitHub
Lesson 60 of 964. Collaborative WorkflowsFree lesson

Opening Pull Requests for Proposed Changes

Master the process of initiating a pull request to formally propose your branch changes for integration into the main project.

In this lesson, you will learn how to formally propose your local code contributions for integration into a shared project by opening a Pull Request (PR) on GitHub.

Why use a Pull Request?

Up until now, you have been merging changes directly into your local main branch. In a collaborative environment, you rarely have permission to overwrite the shared project history directly. Instead, you "push" your completed feature branch to the remote repository and open a Pull Request. This acts as a digital proposal, providing a dedicated space for your team to review your code, discuss improvements, and ensure quality before it ever touches the primary codebase.

The Workflow

Once you have pushed your local branch to GitHub, the repository interface will usually detect the new branch and offer a button to "Compare & pull request." If it doesn't appear automatically, you can navigate to the Pull requests tab on your repository and click the New pull request button.

  1. Select Branches: Ensure the "base" branch (where you want the code to go, usually main) and the "compare" branch (your feature branch) are correct.
  2. Review: GitHub will automatically highlight the differences in your code compared to the main branch.
  3. Describe: Provide a clear title and description of your changes. Mention why the change is needed and how you implemented it.
# Ensure your changes are on the remote first
git push origin feature-login-page

After clicking Create pull request, your teammates can view your commits, leave comments on specific lines of code, and suggest changes. This process transforms your isolated development into a collaborative effort. It creates a historical record of why changes were made, which is invaluable for long-term project maintenance. Once the team approves your work, they can merge the PR into the target branch, effectively integrating your work into the official project.

Key Takeaway: Opening a Pull Request creates a structured, reviewable window for your team to evaluate your proposed changes before they are officially merged into the project's codebase.