magit-gh-pulls is a Magit extension that allows you to conveniently manipulate Github’s pull requests from Emacs.
magit-gh-pulls is available on MELPA. To install it do the following:
M-x package-install RET magit-gh-pulls RET
Now that the package is installed you have to put the following code to your
(require 'magit-gh-pulls) (add-hook 'magit-mode-hook 'turn-on-magit-gh-pulls)
Existing Pull Requests
magit-status window press
# g g to refresh the list of pull requests.
magit-gh-pulls automatically infers credentials from the URL of the
repository. If there are some PRs available, a new section will appear
called Pull Requests. Each item in this section has the following form:
[pull-request-number@branch-name] Pull request name
Highlighting the desired PR and pressing
# g f will fetch the commits
associated with the PR. These are the real commits that you can view, apply,
From this point magit-gh-pulls offers you two options:
# g bon the PR to create a topic branch for this PR. After testing the PR you can merge it back into your branch using Magit.
# g mto merge the PR on top of the currently checked out branch. This is convenient if pull request can be merged by fast-forwarding and no testing is needed (or you can test from your branch directly). A nice benefit of this approach over merging from Github interface is that in case of FF no merge commit is produced, so history stays nice and linear.
Creating Pull Requests
# g c to create a new pull request. You will be asked
for the base commit and the head commit for the pull-request. They will default
to the default branch of your repository and current head respecively. Enter a title
and description for the pull request, and magit-gh-pulls will connect to GitHub to
create the pull request. By default,
the new pullrequest will be opened on github.com in the browser. You may
turn this behavior off by customizing
The base and head of the pull request must already be present on github.
If you haven’t yet pushed your local commits, creating the pull request will fail.
You can push with magit’s standard
# g oWill open the selected a pull request in your default browser on GitHub.
j qwill jump to the Pull Requests section in the