Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are pull requests part of Git, or a feature of tools like GitHub, Gerrit and Atlassian Stash?

Pull requests seem to be the common way to do code review with Git. However, it is not clear whether this term means the same when using the built-in git request-pull, or a different tool.

Are pull requests an intrinsic function of Git, or is it a common term for tools like GitHub, Gerrit or Atlassian Stash?

Is the discussion and "result" of the code review stored in the Git commit history or in a separate database?

like image 373
user3049984 Avatar asked Nov 29 '13 16:11

user3049984


People also ask

Is pull request a Git or GitHub feature?

Pull requests are a simple concept that originated when Git was created but has been taken to different levels since. The essence is that you do not have push rights to the repository you want to contribute on, so instead you fork the repository, making your private copy (a clone already does this btw.)

Is Git pull a pull request?

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


2 Answers

Pull requests are a simple concept that originated when Git was created but has been taken to different levels since.

The essence is that you do not have push rights to the repository you want to contribute on, so instead you fork the repository, making your private copy (a clone already does this btw.) and you contribute to that one instead. And then you ask a maintainer of the original repository to pull in your changes. So you are essentially submitting a patch.

Now as I said, there are different ways to do this, but it all boils down to requesting a maintainer to pull in your changes, hence the name. The original purpose Git was created for is the Linux kernel, and they have been developing using mailing lists forever. So for them, a pull request is actually sending a patch per email; those patches are actually commit objects prepended by some normal email communication stuff—Git has tools to generate this.

git request-pull is a similar tool to generate a message asking for a pull request. But in this case, it’s closer to the pull idea. While patches can just be applied, requests created by request-pull actually tell the maintainer to pull the changes from a different remote repository.

The Git book has this example:

$ 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(-) 

So it’s really just a utility to generate messages to execute the underlying concept.

Other source code hosters like GitHub do this similarly as well. When you create a pull request on GitHub, you just create an issue which contains further information where the commits are the maintainer can pull. Of course, it all being on a single website, they can interlink everything a bit more and provide those one-click merge buttons for example.

But the basic concept is still the same: Requesting a maintainer to pull in some changes you have made. The only difference is the way this request is communicated with.

like image 128
poke Avatar answered Sep 21 '22 05:09

poke


The git request-pull command can be used to create a "pull request" in native git. When run, Git generates a summary of changes to a project and the Git Repository URL where the code can be pulled from. This can then be mailed to a mailing list or the project maintainers, who can then pull in the changes to their own repositories.

This section of the Pro Git book contains more specific information about the git request-pull command.

like image 42
blacktide Avatar answered Sep 25 '22 05:09

blacktide