Skip to content

Instantly share code, notes, and snippets.

@codeinthehole
Created August 14, 2014 11:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeinthehole/62bc2010cc059aa12ff7 to your computer and use it in GitHub Desktop.
Save codeinthehole/62bc2010cc059aa12ff7 to your computer and use it in GitHub Desktop.
Git aliases for quickly opening Github pages
[alias]
# Open the Github page for the...
# ...repo homepage (included for consistency)
open = !hub browse --
# ...repo commits
opencommits = !hub browse -- commits
# ...commit page for HEAD
openhead = !hub browse -- commit/$(git rev-parse HEAD)
# ...commit page for a passed SHA (defaults to HEAD)
opencommit = "!f() { sha=$(git rev-parse ${1:-HEAD}); hub browse -- commit/$sha; }; f"
# ...blame page for the passed file (a line number/range can be passed in too)
openblame = "!f() { sha=$(git log --format='%h' -1 $1); hub browse -- blame/$sha/$1#L$2; }; f"
# ...commit history page for the passed file
openhistory = "!f() { sha=$(git log --format='%h' -1 $1); hub browse -- commits/$sha/$1; }; f"
# ...repo issues
issues = !hub browse -- issues
# ...repo pull requests
pulls = !hub browse -- pulls
# ...repo wiki
wiki = !hub browse -- wiki
# ...repo settings
settings = !hub browse -- settings
# ...repo branches
branches = !hub browse -- branches
# ...repo branches
releases = !hub browse -- releases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment