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