Curious Minds

Clear answers to science and history questions

Why a Git Pull Request Isn't a Push Request

· 7 min read · Science

A git pull request is not called a push request because the term "pull request" describes the action the receiver of the request is asked to take: to pull the proposed changes into their repository. The contributor who wants to contribute does not push changes directly into the main project; instead, they push their changes to a separate branch or fork and then ask the maintainer to pull those changes in. The name reflects the perspective of the person who must act on the request, not the person who created it.

What Is a Pull Request?

A pull request (often abbreviated PR) is a feature of collaborative version control platforms such as GitHub, GitLab, and Bitbucket. It is a formal proposal to merge a set of commits from one branch or fork into another branch of a repository. The request is not a Git command itself; it is a platform-level workflow built on top of Git's branching and merging capabilities. When a contributor opens a pull request, they are saying: "Here are my changes; please review them and, if acceptable, pull them into your branch."

The term "pull request" predates GitHub. It originated in the Git community and was popularized by GitHub's implementation. The core idea is that the maintainer pulls the changes rather than the contributor pushing them directly into the protected branch. This distinction is important because it enforces a review step before changes become part of the main codebase.

How a Pull Request Works

Understanding the mechanics clarifies why "pull" is the operative word. The typical workflow involves several steps:

  1. Fork or branch: The contributor creates a copy of the repository (a fork) or a new branch within the same repository. This isolates their work from the main branch.
  2. Commit changes: They make edits and commit them to their branch, creating a series of commits.
  3. Push to remote: They push their branch to the remote repository (their fork or the shared repository). This step is a push operation, but it does not modify the target branch.
  4. Open a pull request: On the platform, they open a pull request specifying the source branch (their changes) and the target branch (usually the main branch of the original repository).
  5. Review and discuss: Maintainers and other contributors review the changes, leave comments, and may request modifications.
  6. Merge or close: If approved, the maintainer merges the pull request, which effectively pulls the commits into the target branch. If rejected, the pull request is closed without merging.

The key point is that the contributor never pushes directly to the target branch (unless they have permission and choose to bypass the PR process). Instead, they push to a separate location and then request a pull. The platform then performs the merge, which is a pull operation from the perspective of the target branch.

The Perspective Behind the Name

Naming conventions in software often reflect the viewpoint of the person who receives an action. A "pull request" is a request for the maintainer to pull. If it were called a "push request," it would imply that the contributor is asking for permission to push, which is not how the workflow operates. In a push-based model, the contributor would push directly to the target branch, and there would be no request—just a push. The pull request model deliberately inverts this: the contributor pushes to a staging area and asks the maintainer to pull from there.

This perspective is similar to other request types in computing. For example, an HTTP request is sent by a client to a server, and the server responds. The request is named after what the client wants the server to do. In the case of a pull request, the contributor wants the maintainer to pull. The term "push request" would be ambiguous: does it mean a request to push, or a request that is pushed? The pull request name eliminates that ambiguity.

Pull Requests vs. Push Access

In Git, "push" and "pull" are fundamental operations. Push sends commits from a local repository to a remote one. Pull fetches commits from a remote repository and integrates them into the local branch. In a collaborative setting, maintainers often restrict push access to the main branch to a small group of trusted individuals. Contributors without push access must use a fork-and-pull workflow. They push to their own fork, then open a pull request. The maintainer, who has push access, can then pull the changes into the main repository. The pull request is the mechanism that allows someone without push access to propose changes.

If the workflow were called a push request, it would suggest that the contributor is requesting push access, which is not the case. The contributor already has the ability to push to their own fork. What they need is for someone else to pull their changes into the main project. Hence, pull request.

Common Misconceptions

A common misconception is that a pull request is a Git command. It is not. Git itself has no "pull request" command. The functionality is provided by the hosting platform (GitHub, GitLab, etc.). Git has commands like git request-pull, which generates a summary of changes for email-based workflows, but that is a different mechanism. The modern pull request is a platform feature that combines Git operations with a web-based review interface.

Another misconception is that the contributor's changes are automatically merged when a pull request is opened. In reality, the pull request is a proposal; it must be reviewed and explicitly merged by someone with the appropriate permissions. The contributor cannot force the merge unless they have write access to the target branch and choose to merge it themselves, which defeats the purpose of the review.

Some people also confuse pull requests with merge requests. GitLab uses the term "merge request" for the same concept. The choice of terminology is a matter of platform convention. "Merge request" emphasizes the action of merging, while "pull request" emphasizes the action of pulling. Both describe the same workflow: a request to integrate changes from one branch into another.

Why Not Call It a Merge Request?

GitLab and some other platforms do call it a merge request. The term "merge request" is arguably more descriptive of the end result: the changes are merged. However, "pull request" has historical precedence and is widely recognized. The choice between the two terms often comes down to the platform's philosophy. GitHub, which popularized the pull request, chose "pull" to reflect the distributed nature of Git: you pull from a remote. The maintainer pulls the changes from the contributor's repository. In a centralized system, merging might be more intuitive, but in a distributed system, pulling is the fundamental operation.

Ultimately, both terms are valid. The important thing is that the name reflects the action taken by the person receiving the request. Whether you call it a pull request or a merge request, the workflow is the same: propose changes, review, and integrate.

Frequently Asked Questions

Is a pull request the same as a push?

No. A push is a Git operation that sends commits to a remote repository. A pull request is a platform-level request to review and merge changes from one branch into another. You push your changes to a branch, then open a pull request to have them pulled into the target branch.

Can I open a pull request without pushing?

No. The changes must exist in a remote repository (such as your fork) before you can open a pull request. The platform needs to compare the source branch with the target branch, so the commits must be pushed to a remote that the platform can access.

Why is it called a pull request if I'm pushing my changes?

You push your changes to your own branch or fork, but the pull request asks the maintainer to pull those changes into their branch. The name reflects the action the maintainer takes, not the action you take.

What is the difference between a pull request and a merge request?

They are essentially the same thing. GitHub uses "pull request," while GitLab uses "merge request." Both refer to a request to integrate changes from one branch into another, typically with a review process.

Do I need special permissions to open a pull request?

No. Anyone can open a pull request on a public repository by forking it and pushing changes to their fork. However, you need permission to merge a pull request into a protected branch. On private repositories, you need access to the repository to open a pull request.

Can a pull request be rejected?

Yes. Maintainers can close a pull request without merging it if they decide the changes are not suitable. They may also request modifications before considering a merge.

In this article
  1. What Is a Pull Request?
  2. How a Pull Request Works
  3. The Perspective Behind the Name
  4. Pull Requests vs. Push Access
  5. Common Misconceptions
  6. Why Not Call It a Merge Request?
  7. Frequently Asked Questions