Git Pull vs. Pull Request

Jonn picture Jonn · Mar 23, 2014 · Viewed 37.2k times · Source

I'm new to using Git, so I apologize if this is trivial. I have a private repository set up using Github and EGit.

To update and merge my local repository branch with the remote version (essentially a git pull), I use Team > Pull in Eclipse.

To merge a branch into the master branch, I have to request and subsequently approve a Pull Request on Github.

What is the difference between calling git pull and sending a pull request?

I've seen that this is related to a Fork and Pull collaborative development model and is used for code reviews. I think I understand the motivation and usefulness of a pull request, but what exactly is it?

Answer

Bruno picture Bruno · Mar 23, 2014

If you use git pull, you pull the changes from the remote repository into yours.

If you send a pull request to another repository, you ask their maintainers to pull your changes into theirs (you more or less ask them to use a git pull from your repository).

If you are the maintainer of that repository, it seems you're making it a bit more difficult by pretending you're playing two roles in that workflow. You might as well merge locally your development branch into your master branch and push that master branch into your GitHub repository directly.

(As a side note, if you're new to Git, I'd suggest using git fetch and then git merge instead of git pull. git pull is effectively git fetch followed by git merge, but doing them separately gives you better control over potential conflicts.)