Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Pull vs. Pull Request

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?

like image 825
Jonn Avatar asked Mar 23 '14 00:03

Jonn


People also ask

Is Git pull and pull request same?

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).

What do you mean by pull and pull request?

The term pull is used to receive data from GitHub. It fetches and merges changes from the remote server to your working directory. The git pull command is used to pull a repository. Pull request is a process for a developer to notify team members that they have completed a feature.

What is the difference between pull request and push request?

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. It depends on who are you requesting, if it is your team a "push request" makes more sense, if it is the remote repository your absolutely right.

What is a Git pull?

The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Merging remote upstream changes into your local repository is a common task in Git-based collaboration work flows.


2 Answers

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.)

like image 189
Bruno Avatar answered Sep 29 '22 18:09

Bruno


A pull request is requesting the maintainer of a repository to git pull in some changes (as the name already suggests). GitHub provides an additional easy to use interface that simplifies review of such a request.
You don't need to use it to merge in some branch. But you can use it and it may be helpful to recheck whether all changes are ready to be merged. If you don't want or need that additional safety you can simply git merge the branch.


git itself also has a command that creates a pull request, designed for the use in mailing lists. You can request the generation with the git request-pull command. In fact it is required to hand in a pull request for some projects using this command! The output of the command looks similar to this (taken from the official git homepage):

$ git request-pull origin/master myfork The following changes since commit 1edee6b1d61823a2de3b09c160d7080b8d1b3a40:   John Smith (1):         added a new function  are available in the git repository at:    git://githost/simplegit.git featureA  Jessica Smith (2):       add limit to log function       change log output to 30 from 25   lib/simplegit.rb |   10 +++++++++-  1 files changed, 9 insertions(+), 1 deletions(-) 
like image 23
TimWolla Avatar answered Sep 29 '22 17:09

TimWolla