Endless Parentheses

Ramblings on productivity and technical subjects.

profile for Malabarba on Stack Exchange

Merging Github Pull Requests from Emacs

Last week, Bin Chen shared his workflow for merging Github pull requests. Other than the use of Firefox instead of Conkeror, it was identical to mine. Now I gladly come to admit that Alexander Yakushev has outsmarted us both by fixing up magit-gh-pulls-mode, a package originally written by Yann Hodique which does it all from within Magit.

You can find the keybinds on the Readme page.

It bothers me very slightly that it immediately queries for pull-requests when I first call magit-status, even if I’m not interested in pull-requests at the moment. So we change the suggested setup in order to fix that.

(when (fboundp 'magit-gh-pulls-mode)
  (eval-after-load 'magit
    '(define-key magit-mode-map "#gg"
       #'endless/load-gh-pulls-mode))

  (defun endless/load-gh-pulls-mode ()
    "Start `magit-gh-pulls-mode' only after a manual request."
    (interactive)
    (require 'magit-gh-pulls)
    (add-hook 'magit-mode-hook #'turn-on-magit-gh-pulls)
    (magit-gh-pulls-mode 1)
    (magit-gh-pulls-reload)))

With this setup it’ll only activate magit-gh-pulls-mode after you try to update the list of pull-requests.

comments powered by Disqus