Skip to content

Instantly share code, notes, and snippets.

@JohnSundell
Created April 30, 2018 07:51
Show Gist options
  • 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/"[email protected]:"/"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