Skip to content

Instantly share code, notes, and snippets.

@hmps
Created January 13, 2016 12:15
Show Gist options
  • Save hmps/d7385f019483d4ab674d to your computer and use it in GitHub Desktop.
Save hmps/d7385f019483d4ab674d to your computer and use it in GitHub Desktop.
Open Git remote url in Safari
#!/bin/bash
#
# Usage
# 1. Put this file somewhere safe in your file system
# 2. Make sure it is executable: chmod +x gor.sh
# 3. Create an alias in your CLI.
#
# Example alias:
# alias gor='bash ~/.cli-scripts/gor.sh';
if url=$(git remote -v | grep -Eo -m 1 'http.*. ')
then
open -a"Safari" $url
else
echo "Could not find a remote url."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment