The version for Git Bash (windows). It replaces the open command and for some reason it cannot parse a nested variable modification (line 17)
function GitHub() { if [ ! -d .git ] ; then echo "ERROR: This isnt a git directory" && return false; fi git_url=`git config --get remote.origin.url` git_domain=`echo $git_url | awk -v FS="(@|:)" '{print $2}'` git_branch=`git rev-parse --abbrev-ref HEAD 2>/dev/null` if [[ $git_url == https://* ]]; then url=${git_domain}/${git_url%.git}/tree/${git_branch} else if [[ $git_url == git@* ]] then cut_off=${git_url#*:} url=https://${git_domain}/${cut_off%.git}/tree/${git_branch} else echo "ERROR: Remote origin is invalid" && return false; fi fi explorer $url }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The version for Git Bash (windows). It replaces the open command and for some reason it cannot parse a nested variable modification (line 17)