Skip to content

Instantly share code, notes, and snippets.

@JohnSundell
Created April 30, 2018 07:51
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnSundell/4354bbe7f31f66e794da489d4da72183 to your computer and use it in GitHub Desktop.
Save JohnSundell/4354bbe7f31f66e794da489d4da72183 to your computer and use it in GitHub Desktop.
Script that makes it easy to show a Git repo on GitHub.com
#!/usr/bin/env bash
# If run without a name, open any current repo
if [ -z "$1" ]; then
URL=$(git remote get-url origin)
URL=${URL/"git@github.com:"/"https://github.com/"}
URL=${URL/".git"/""}
open $URL
else
open "https://github.com/$1"
fi
@Abizern
Copy link

Abizern commented Apr 30, 2018

If you use https://github.com/github/hub, then hub browse does the same thing. :)

@shaps80
Copy link

shaps80 commented May 2, 2018

@Abizern @JohnSundell personally I really love writing a bunch of tiny shell scripts for the following reasons:

  • great skill to have in your toolbox
    • a skill that requires constant practise ;-)
  • no installation required, I use Mackup across my machines or download from my GitHub dot files and away I go
  • I wrote the code and can see it, easier to customise over time

I have a similar script for opening Xcode from the current directory. Handles multiple projects/workspaces (via option list) etc...

openx

Not the best code but if you want it:
https://gist.github.com/shaps80/9652980

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment