How to accept the github pull request efficiently
I use keyboard only in order to maximize my productivity.
Open pull request page at github.com, click the link "command line".
In a real world project, I rarely accept a pull request without some modification. So I usually avoid pressing the big green button "merge pull request" on that page.
In the "command line" page, github is kind enough to list the command lines to "check out a new branch and test the changes" from the pull request. The command lines are like:
git checkout -b her-master master git pull email@example.com:her/myproject.git master
I have installed a Greasemonkey user script NinjaWebCoder in order to use keyboard to copy those command lines from the browser into clipboard. Then I paste the command lines into terminal.
I open the code file with Emacs.
There is an Emacs addon called git-gutter. I use its command "git-gutter:next-hunk" to move the cursor to the next "diff hunk".
Let me explain what's the diff hunk. When you edit some code under git's control, you code has some difference with the HEAD version. Every difference corresponds to the pair of a file name and a line number. That file-name-line-number pair is defined as a "diff hunk".
Now comes the most important part of this article. Since version 0.71, git-gutter added a new command "git-gutter:set-start-version". If I "git-gutter:set-start-revision" to the "HEAD^" version. I can jump to "diff hunk" of the difference between "HEAD" and "HEAD^".
In short, I can review the latest commit and change the code in one step.
After review and code change, the remaining book-keeping things (git-commit/git-merge/git-push) are easy.
Every operation in previous steps is optimized with some shortcut. For example, in shell I use alias "g" instead of full command line "git status".
Please enlighten me if the work flow could be improved.