Skip to content

Instantly share code, notes, and snippets.

@frm
Created April 18, 2016 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frm/a34a5ab2011cfedb59309171bd256186 to your computer and use it in GitHub Desktop.
Save frm/a34a5ab2011cfedb59309171bd256186 to your computer and use it in GitHub Desktop.
Opening git repo in browser
#!/bin/sh
# Latest version probably in my dotfiles repo
if [[ $# -eq 0 ]]; then
DIR=.
else
DIR=$1
fi
# Use --git-dir=$DIR/.git if git version < 1.8.5
open $(git -C $DIR remote -v \
| awk '/fetch/ { print $2 }' \
| sed -e 's/:/\//' \
-e 's/git@/https:\/\//' \
-e 's/\.git$//')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment