Create Github PRs from Emacs with Magit (again)22 Jun 2015, by Artur Malabarba.
GitHub Integration post series
- Merging Github Pull Requests from Emacs
- Automatically configure Magit to access Github PRs
- Easily Create Github PRs from Magit
- Create Github PRs from Emacs with Magit (again)
I don’t usually dedicate an entire post to something I’ve already done in a
previous one, but this nugget is so useful it deserves the attention. Remember
how you can create Github PRs straight from Magit? Magit
2.1.0 is barely
two weeks away, and it brings so many (awesome) changes that our little snippet is
going to break.
Luckily for you, I’ve been using Magit’s next version for a couple of months now, so I have a fix all shiny and ready for you. This function is also slightly more robust, and fixes some corner-case issues in the other. So if you found that the previous function didn’t cover your use-case, you should definitely try the new one.
Note that I’ve changed the keybind to v. In Magit
2.1, that key is bound in
buffer overlays, not on the mode-map, which means we can just bind it in the map
and we’ll get a semi “do-what-I-mean” functionality.
The latest Magit from Melpa deals with branches in a slightly different way, so the code above won’t quite work. If you run into that problem, the update below should work fine.