Skip to content

Instantly share code, notes, and snippets.

@bzd111
Last active April 26, 2023 09:26
Show Gist options
  • Save bzd111/e01d01d220f0a914d53fb8b91257a375 to your computer and use it in GitHub Desktop.
Save bzd111/e01d01d220f0a914d53fb8b91257a375 to your computer and use it in GitHub Desktop.
open git repo url in command line
function gbrowse(){
remote="origin"
if [ ! -z "$1" ];then
remote=$1
fi
origin="git config --get remote.$remote.url"
url=`eval $origin`
if [[ $url == git* ]]; then
url=$(sed 's/:/\//g' <<< "$url")
url=${url/git@/http://}
fi
if [[ ! -z $url ]]; then
open -a "Google Chrome" $url
fi
# remote="origin"
# if [ -z "$1" ];then
# remote=$1
# fi
# # if [[ condition ]]; then
# # fi
# url=`git config --get remote.$remote.url`
# if [[ ! -z $url ]]; then
# open -a "Google Chrome" $url
# fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment