Skip to content

Instantly share code, notes, and snippets.

@larskluge
Created August 23, 2015 11:48
Show Gist options
  • Save larskluge/aac4463372af6de66bb2 to your computer and use it in GitHub Desktop.
Save larskluge/aac4463372af6de66bb2 to your computer and use it in GitHub Desktop.
Open Github.com with your current project from the command line

Open Github Project Page

Usage

cd ~/some-project
gh

Now your default browser opens with github.com/path/to/some-project.

Installation

  1. Download gh script
  2. Place somewhere in your $PATH to have it globally accessable
#!/usr/bin/env ruby
# vim: set ft=ruby
if Dir.exists?(".git")
repo_url = `git config remote.origin.url`.strip
if !repo_url.empty? and repo_url =~ /github\.com[:\/](.*)\.git$/
`open "https://github.com/#{$1}"`
exit 0
end
end
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment