12

What is git request-pull and how does it compare to making a pull request, e.g. on github?

1. How is it supposed to be used?

2. Can it be used as replacement for pull requests (e.g. on github)?

3. What are the advantages of using it?

jschnasse
  • 8,526
  • 6
  • 32
  • 72
  • @LasseVågsætherKarlsen: while certainly a different tool than PRs on GitHub/GitLab/etc, the first line of its description being `Generate a request asking your upstream project to pull changes into their tree.` sounds pretty close in the idea, with the difference of no coordinating website required. Run command, take what it dumped to stdout and send someone as email/blogpost/etc. – quetzalcoatl Mar 22 '18 at 08:28
  • Pull requests aren't part of git, they're part of the hosting service. This command cannot create a pull request. It produces a patch that can be used for pulling changes into a repository, this patch needs to be communicated to the repo owner, using a mailing list or email or discussion forum or whatnot. – Lasse V. Karlsen Mar 22 '18 at 08:28
  • My question is, has someone used it in their workflow, and how? I would find it very interesting to have something like a "standardized pull request" that doesn't depend on a single platform and adds documentation to gitlog, etc. – jschnasse Mar 22 '18 at 08:32
  • My guess, sure, Linus and linux kernel guys? – quetzalcoatl Mar 22 '18 at 08:33
  • Git Book, chapter "Contributing to a Project", paragraph "Forked Public Project" - see online here: https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project - btw it also describes `email/patch` workflow/command, also very useful – quetzalcoatl Mar 22 '18 at 08:35
  • Ah, the idea is to "email the subsequent output to the project maintainer manually." ? – jschnasse Mar 22 '18 at 08:40
  • @jschnasse yeah. `request-pull` just creates a patch summary. Literally just a textual output. – evolutionxbox Mar 22 '18 at 09:52
  • So, reviewing and discussion is done via mailing list or at issue tracker or similar. I wonder if there are tools that support this kind of workflow, e.g. display textual output in a webinterface or something. I mean, without reinventing pull requests.... – jschnasse Mar 22 '18 at 09:59

2 Answers2

10

The git request-pull command predates hosting services. As noted in comments, it's meant for a workflow that tends to include running git format-patch and git send-email to pass patches around via email. Once the patches have been tested and approved, the patch-generator might make the commits accessible on a public server that they or their company provide, and send a final email message to the project maintainer announcing that they have the cleaned-up, rebased, etc., project-topic ready for merging.

For example, suppose a guy named Phil Systeme has a Linux kernel patch for a file system. He has a clone of the Linux kernel tree, as of some Linux release. His patch consists of one giant commit to a dozen or so files, which he sends to the file-system maintenance list, with a subject line:

PATCH: make the foo file system better

The feedback on the file-system maintenance mailing list first says: break this into at least six smaller parts. Phil Systeme breaks up his Phile System patch into eight logical smaller patches, each of which does something useful and still builds. He sends out 9 messages this time:

[PATCH v2 0/8]: make the foo file system better

(description of what the patch series is about)

[PATCH v2 1/8]: split up the xyzzy function

As a prerequisite for improving the foo file system, break
a large function into several smaller ones that each do one
thing.  We'll use this later to work better and add new features.

[PATCH v2 2/8]: ...

This time, he gets feedback that says it looks better but he forgot to account for the fact that ARM cpus require one special thing and MIPS CPUs require a different special thing. So he sends out a third round of [PATCH v3 m/n] messages, and so on.

Eventually, the file system maintenance lieutenant(s) agree that this patch should go in. Now Phil, or the lieutenant, converts the emailed patches to actual Git commits, applied to a current development kernel, or to a maintenance kernel, or whatever. Linus Torvalds trusts this person enough at this point that this person can say: "here is a Git repository with new commits that you should add to the kernel." Linus can then git pull directly from this other repository, or more likely, git fetch from there and decide whether and how to merge them, or whether to insult the person. :-)


Hosting services like GitHub and Bitbucket claim, or feel, or whatever verb you like here, that their "pull request" mechanism is superior to all this email. In some ways, it pretty clearly is; but their enthusiasm for hiding the actual commit graph, which really does matter if you're going to use a true merge, is kind of a mystery to me.

torek
  • 448,244
  • 59
  • 642
  • 775
  • 1
    Hi and thx for answering. What do you mean by "hiding the actual commit graph"? Who or what is the patch-generator? Sorry if these questions feel stupid, but knowing git only in combination with github this opens a new world to me. – jschnasse Mar 22 '18 at 15:31
  • The "patch-generator" here is the person or group who wrote the series of patches and then revised them according to responses on the mailing list. The commit graph is the one you can see with some Git GUIs, or with `git log --graph` (try `git log --all --decorate --oneline --graph`). – torek Mar 22 '18 at 16:31
  • Thanks. I'd appreciate if you could consider https://stackoverflow.com/questions/54218945/what-are-the-relations-between-git-pull-request-and-git-pull-and-git-push – Tim Jan 19 '19 at 00:48
2

1. A Pull Request supports the controlled adoption of code modifications into a given code base over a Web-UI, provided by a hoster (e.g. github, bitbucket). Example.

2. git request-pull is a git command that eases the process of contributing patches over email without depending to the services of a single hoster. Example.

+-----------------+--------------------------------+--------------------------+
|     Action      |           Pull Request         |       git request-pull   |
+-----------------+--------------------------------+--------------------------+
| authentication  |  Register and login at hoster  |  Full Name, Signed Email |
| description     |  Web-Ui                        |  Patch, Email            |
| discussion      |  Web-Ui                        |  Email, Mailinglist      |
| review          |  Web-Ui                        |  Email, Mailinglist      |
| adoption        |  One button `merge` action     |  git pull/push           |
+-----------------+--------------------------------+--------------------------+
jschnasse
  • 8,526
  • 6
  • 32
  • 72