Skip to content
Patch helper for GitHub
Find file
New pull request
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


r2go -- patch helper for GitHub

This program contains useful commands to view and manage pull requests from your command line. Currently it recognizes three commands: diff, patch and land.

r2 diff shows either a list of all open pull requests or information (including the actual diff) about one particular pull request.

> r2 diff
GH-471 Added recursive directory support to WSH wrapper
GH-463 Treat try and finally blocks as ordinary in that they don't affect scope

>r2 diff 471
GH-471 Added recursive directory support to WSH wrapper

The WSH env now has support for passing in a directory name.

The only functional change that was made for single files is
that the passed script name is spit out in the output just like when running
against a directory. Let me know if that is a problem and I can make a change.

diff --git a/env/wsh.js b/env/wsh.js
index d9efb6a..51b7bae 100644
--- a/env/wsh.js
+++ b/env/wsh.js


r2 patch creates a new branch and applies changes from a pull request to it.

> r2 patch 471
Getting patch information.
Checking out new branch.
Applying patches.
Patch applied.

r2 land takes the patch applied with r2 patch and merges it into master with a helpful commit message.

> r2 land 471
Getting patch information.
Switching to branch master.
Merging branch patch-1.
Deleting local branch patch-1.

r2 learns about the current repo by reading a special JSON file named .r2config. This file should contains something like this:

> cat .r2config
{ "repo": "antonkovalyov/r2go" }

> cd ../jshint/
> cat .r2config
{ "repo": "jshint/jshint" }

What's wrong with GitHub's green merge button?

  1. You have to go from CLI to the website.
  2. The merge commit message is quite useless. r2 land generates a message with pull request's title, body and a list of commits.

Is this stable software?

No. I wrote it during my lunch and coffee breaks. And this is the second time I write Go in my entire life. That said, I intend to use and improve this program.

How to install?

  1. Get Go release candidate from and install it.
  2. Go into project's directory and run go build r2.go.
  3. That's it, Go is that awesome.

Your Go code sucks

Code reviews and patches are appreciated.

Fun fact

Initially I started writing r2 in JavaScript/Node but then got bored (I do JavaScript for a living) and decided to write it in Go instead. You can check out my unfinished JavaScript version of r2 here:

Something went wrong with that request. Please try again.