18

I'm specifically interested in pull requests, editing issues and tying them to commits, and other things I generally have to use hub on the command line for. However, I've started using magit and really like the keybindings and general interface---I'd like to stay in emacs for this part, too, rather than needing to keep an extra shell open for pull requests, issues, etc.

The packages that might add the most github functionality to magit that I could find are:

Can anyone, possibly involved with these projects, recommend how they'd compare and what might be best for integrating pull requests into a magit environment?

Mittenchops
  • 15,641
  • 28
  • 103
  • 200
  • You can create custom functions that use `call-process` and `set-process-sentinel` and shell-out behind the scenes so that you never feel like you are leaving the current buffer -- the libraries you mentioned are shelling-out anyway. If the function you want doesn't exist, then just create it like the unrelated function in the following link (which pushes to multiple repositories): http://stackoverflow.com/a/23178396/2112489 – lawlist Jun 02 '14 at 19:29
  • 3
    Editors always close questions asking for recommendations, but I want to cite the answer I got here again as a perfect example of why asking for software recommendations can be an awesome thing and totally in line with SO objectives if done right. The developer of the package offered an excellent comparison of the options and their histories---that is /exactly/ what I needed and why it's fantastically useful! – Mittenchops Jun 04 '14 at 14:08

2 Answers2

26

Eventually I will implement such things in Magit (I am the maintainer), but I first have to get a release out.

Old outdated information: Unfortunately there currently also isn't a third-party extensions that could fill this role. magithub has been broken for a long time now. magit-gh-pulls (by Yann, my predecessor as Magit maintainer) also wasn't kept in sync with the changes in Magit. I tried to fix it up some time ago, but gave up when it became clear that doing so would result in a complete rewrite . gh.el is also written by Yann and is used by magit-gh-pulls. I have contributed to it in the past but eventually stopped using it because (a) it uses url.el and that turned out to be very unreliable (b) it's over complex.

So I am afraid there currently isn't a package that does what you want. If you want to write it yourself, I recommend you use request.el and then only implement those parts of the Github api that you actually need, to avoid over-engineering it.

Edit: As of October 2015 magit-gh-pulls is maintained again, but no longer an official extension. Personally I don't use it, as I think it should either to more or less. I currently use "less" in the form of magit-branch-pull-request from the magit-rockstar library. Even though I maintain that library, I do not consider it an official extension - it's provided as-is. That function is very basic, you give it an issue number and it creates a branch for you, that's it.

Edit in September 2016: I have written ghub.el and glab.el as replacements for gh.el. They are mostly intended for my own personal use and provide very little, basically they give you functions such as ghub-get (resource &optional params data noerror), you then have to look at the respective api documentation to figure out what resource, params, and data you have to use. Also the error handling isn't great and this currently uses url.el. I intend to improve both eventually by using libcurl some time after an Emacs with ffi support has been released.

Edit in January 2020: More than a year ago I have released forge.

Forge allows you to work with Git forges—such as Github and Gitlab—from the comfort of Magit and the rest of Emacs.

Community
  • 1
  • 1
tarsius
  • 7,061
  • 5
  • 30
  • 42
  • 1
    Any further thoughts on this, nearly a year later? I just saw that atom has a plugin for some nice looking support to view github pull request comments inline in the editor, which would be beautiful in magit or some sort of magit+github integration (the atom plugin for reference https://github.com/philschatz/atom-pull-requests), not sure where they would best fit. – wonderfulthunk Aug 09 '16 at 18:59
  • I'm hoping that our contributing to the [magit kickstarter](https://www.kickstarter.com/projects/1681258897/its-magit-the-magical-git-client) will give a boost to this. – Micah Elliott Sep 20 '17 at 18:50
  • It surely will! – tarsius Sep 20 '17 at 21:52
2

You can get simple "manual" Github support by setting magit-git-executable to "hub". Then you can use all hub commands and features through magit-git-command (bound to : in Magit buffers). This at least allows you to interact with Github through Emacs/Magit.

Although note that as of this writing, this will not work because the release version of hub does not recognize the --literal-pathspecs option , which Magit uses (see here). So until the next release, you need to install hub from the latest source: https://github.com/github/hub#source

Ryan C. Thompson
  • 37,328
  • 27
  • 87
  • 147
  • I've got this working locally (replacing the `magit-git-executable` to `"hub"`), and it does function OK with hub version 2.2.3. It has an unfortunate side effect of making every magit operation slower by at least an order of magnitude if not more. – wonderfulthunk Aug 09 '16 at 18:55
  • 1
    Indeed, setting `magit-git-executable` to `"hub"` slows things down a lot. I've found a happy medium in configuring magit to only replace git with hub when running a command interactively through `magit-git-command`: https://github.com/DarwinAwardWinner/dotemacs/blob/master/config.org#use-hub-instead-of-git-sometimes – Ryan C. Thompson Aug 10 '16 at 02:14