Code Vigorous


navigation
home
github
mozillians
email
about
Dustin J. Mitchell

Git Utilities

24 Dec 2014

I work with Git and GitHub all the time. Together, they make lots of things easy, but a few things require more keystrokes and pointy-clicking than I’d like. So I’ve built some utilities to help me out. They’re nothing much, but today I took a few spare minutes to put them on (where else?) GitHub so that others may use them, too.

git-ghpull

The first is called git-ghpull. This tool makes it easy for a maintainer to merge the commits on a pull request into the upstream repository. In fact, it is almost identical to the “merge pull reqest” button on the web UI, except that it’s not a button in a UI. More importantly, it only merges the changes locally, so you can perform a last round of validation before pushing back to the upstream repository.

In Buildbot, I use this to merge pull requests that have passed Travis tests and review, but I run the full validation suite locally before pushing. This helps to catch any bugs introduced by the merge – it happens!

git-issue2pr

GitHub has a little oddity in its tracking of issues and pull requests. Let’s say you’re working on issue #123, and after some discussion in the issue, you finally have a fix ready for a pull request. If you create a pull request with the web UI, you start a completely new conversation about your pull request, rather than continuing the conversation in the issue.

It’s actually possible to turn an issue into a pull request by supplying a branch containing some commits – it’s just not possible via the GitHub UI. In fact, http://issue2pr.herokuapp.com/ does just that – fill in a few form fields, click “Transmute!”, and you’re good to go.

I’ve been hooked on this tool for a few months now, but the filling-in and clicking was wearing on me. So I wrote git-issue2pr to do exactly the same thing, but from the command line. It figures out most of the settings from your git configuration, so transmuting is as simple as git issue2pr!