As cqlengine has picked up in popularity, so has my need to review pull requests. Here’s the git alias that I’m using:

[alias]
    pr = "!f() { git checkout -b pr_$1; curl https://github.com/cqlengine/cqlengine/pull/${1}.patch | git apply -3 - ;  }; f "

To use, you simply git pr 51 or whatever the pull request is.

Here’s what it’s doing:

  1. Creating a branch pr_[pull request number]
  2. Pulling down the patch
  3. Piping the patch to apply. The -3 indicates a 3 way merge. If we don’t use this option and we have conflicts, it just sort of fails.

We could optionally do this in our master branch and eliminate the git checkout portion, then it would simply be a matter of a merge commit & a push to finish things up.