Why is a git 'pull request' not called a 'push request'? Why is a git 'pull request' not called a 'push request'? git git

Why is a git 'pull request' not called a 'push request'?


If you have a code change in your repository, and want to move it to a target repository, then:

  • "Push" is you forcing the changes being present in the target repository (git push).
  • "Pull" is the target repository grabbing your changes to be present there (git pull from the other repo).

A "pull request" is you requesting the target repository to please grab your changes.

A "push request" would be the target repository requesting you to push your changes.


When you send a pull request, you're asking (requesting) the official repo owner to pull some changes from your own repo. Hence "pull request".


tl;dr since I am not allowed to make a push, I'll just nicely make a request to the repo owner so they decide to pull


Who can push code to a repository?

Should anyone (possibly evil or uneducated or unknown) be able to come and say here I just pushed this to your master branch and messed up all your code HAHAHA! ?

Surely you don't want him to do that. By default a safety net is set so no one can push to your repo. You can set others as a collaborator, then they can push. You would give such access to people you trust.

So if you're not a collaborator and try to push, you will get some error indicating you don't have permission.


So how can other developers push to a repo they are not given permission to push?
You can't give access to everyone, yet you want to give others an outlet/entry point so they can make 'a request to the repo owner to pull this code into the repo'. Simply put by making the repo accessible, they can fork it...make their changes in their own fork. Push their changes to their own fork. Once it's in their in their own remote repo:

They make a pull request from their fork and the owner of the upstream repo (which you can't push directly to) will decide whether or not to merge the pull request.


To explain it from a different angle:

pushing is for things you don't need anyone's approval e.g. you can always push to a feature branch that you've created yourself and have been committing to.

While you can create a pull request between two branches you've created yourself and can push onto. You almost never do that.

I've done that though when I was working on a big feature and already approvals on my pull request, but needed to make a tricky change, so I created a PR against my existing branch.

If you then need approval, then you don't want to push. You want others to:

  1. review your branch
  2. give you approvals
  3. fetch your branch
  4. merge it with master

(3+4 = git pull)


Also a semi-related question I recommend reading What exactly happens in a git push? Why isn't a git push considered just like a git merge?