Last active
April 26, 2023 09:26
-
-
Save bzd111/e01d01d220f0a914d53fb8b91257a375 to your computer and use it in GitHub Desktop.
open git repo url in command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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