Last Updated: February 25, 2016
·
535
· Lorin Hochstein

Open GitHub to a specific commit

Here's a zsh function that uses [hub][1] to open your browser to show a specific commit on github.

function commit
{
    repo=$(git remote show origin -n | grep "Fetch URL" | sed 's/.*:\(.*\)\.git/\1/')
    hub browse $repo commit/$1
}

Invoke it like this, from inside a git-managed directory :

$ commit 4a8c4f889b

[1]: https://github.com/github/hub