Skip to content

Instantly share code, notes, and snippets.

@jeremyf
Created August 7, 2009 14:10
Show Gist options
  • Select an option

  • Save jeremyf/163920 to your computer and use it in GitHub Desktop.

Select an option

Save jeremyf/163920 to your computer and use it in GitHub Desktop.
# Two spiffy github commands. One is to go to the appropriate branch
# The other is to open up the issues, allowing for passing a param and opening
# the specific issue
[alias]
# Open the current branch on github
hub = "! br=$(git branch --contains HEAD | sed -En \"s/^\\* //p\"); if ! git ls-remote . | grep -q -e \"refs/remotes/.*/${br}\"; then br=\"master\"; fi; open $(git config -l | sed -En \"s%remote.origin.url=git(@|://)(github.com)(:|/)(.+/.+).git%https://\\2/\\4/tree/${br}%p\")"
# Go to the github project's issues
# $ git hub-issue
# => open browser and go to project's issues
#
# $ git hub-issue 32
# => open in a browser the specific issue #
hub-issue = "!sh -c 'url=$(git config -l | sed -En \"s%remote.origin.url=git(@|://)(github.com)(:|/)(.+/.+).git%https://\\2/\\4/issues/#issue/%p\"); open \"${url}$1\"' -"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment