6

In the previous version of Magit, I learned from oremacs that you can view and checkout Github pull-requests in Magit by adding the following line to a remote's definition in .git/config.

fetch = +refs/pull/*/head:refs/pull/origin/*

With this, I could type b b and the PRs would be available with TAB-completion.

This seems to no longer be the case in version 2.1.0. Is there a similar alternative?

Malabarba
  • 22,878
  • 6
  • 78
  • 163

3 Answers3

4

For my own purposes I have also added a little helper to magit-rockstar: magit-branch-pull-request. But note that everything in that library is provided as-is (i.e. instead of blogging about snippets, I stuff them into this library). From the library commentary:

Also included are tools that are either only useful for people working on Magit itself and/or that aren't ready to be added to Magit yet. These tools might change at any time, without prior notice or way to appeal. This is a staging ground. It's okay if things ain't perfect, or if they only do what I currently need but not what you (or I) think they should (eventually) be doing instead.

Of course magit-gh-pulls is another, more complete, alternative, but I intend to eventually replace that with something even more feature-full directly in Magit. Until I get there, magit-branch-pull-requests provides the basic feature that I need. While magit-gh-pulls does a few things in ways that I don't think are optimal. (Most importantly, it brings in dependencies I would like to avoid (in particular gh.el which has been accumulating issues)).

tarsius
  • 25,298
  • 4
  • 69
  • 109
1

magit-read-other-branch-or-commit now also offers certain other non-branch refs for completion. Should something be missing, then you can still input the ref or abbreviated ref, without the help of completion. Provided the input is unambiguous, that works with the commands that use this function to read a branch or arbitrary commit.

tarsius
  • 25,298
  • 4
  • 69
  • 109
1

An alternative solution is to use magit-gh-pulls. I use it with Magit 2.1 to manage Spacemacs.

syl20bnr
  • 2,095
  • 11
  • 21