sigma / magit-gh-pulls

Magit plugin for dealing with GitHub pull requests
254 stars 48 forks source link

** Installation

magit-gh-pulls is available on [[https://melpa.org/][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 =init.el=:

+BEGIN_SRC elisp

(require 'magit-gh-pulls) (add-hook 'magit-mode-hook 'turn-on-magit-gh-pulls)

+END_SRC

** Usage

***** Existing Pull Requests

  In =magit-status= window press =# g= to refresh the list of pull requests.
  magit-gh-pulls automatically infers credentials from the URL of the
  repository. You can also explicitly specify which Github project to fetch
  PRs from by executing this in your shell:

  : git config magit.gh-pulls-repo <user>/<repo> # your github 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 =# f= will fetch the commits
  associated with the PR. You can then press =TAB= to reveal the list of
  commits which comes with this PR. They are real git commits that you can
  view, apply, cherry-pick etc.

  From this point magit-gh-pulls offers you two options:

  - press =# b= on the PR to create a topic branch for this PR. After
    testing the PR you can merge it back into your branch using Magit.
  - press =# m= to 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 by default, so history stays nice
    and linear. If you still want the merge commit, enable =-c= option while
    in magit-gh-pulls menu.

***** Creating Pull Requests

  In =magit-status= press =# c= to create a new pull request. You will be
  asked for the base commit and the head commit for the pull-request. A PR
  editor will open where you can customize the title and the body of the
  pull request. Finally, pressing =C-c C-c= will connect to GitHub to create
  the pull request. If =-w= option is enabled, the new pull request will be
  opened on github.com in the browser.

  /Hint: install/ =markdown-mode= /to automatically use it in PR editor./

  The base and head of the pull request must already be present on Github.
  If you haven't yet pushed your local commits, magit-gh-pulls will suggest
  to push them first.

***** Miscellaneous

  - =# o= Will open the selected a pull request in your default browser on GitHub.
  - =j q= will jump to the Pull Requests section in the =magit-status= window.

** License

Copyright © 2011-2016 Yann Hodique, Alexander Yakushev and [[https://github.com/sigma/magit-gh-pulls/graphs/contributors][contributors]]. Distributed under the GNU General Public License ver. 2. See the header of the [[https://github.com/sigma/magit-gh-pulls/blob/master/magit-gh-pulls.el][source file]].