Just a small & quick modification to add current branch & non-github domain -
alias github=GitHub
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-vFS="(@|:)"'{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
url="https://${git_domain}/${${git_url#*:}%.git}/tree/${git_branch}"echo$urlelse
echo"ERROR: Remote origin is invalid"&&return false;fi
fi
open $url}
Just a small & quick modification to add current branch & non-github domain -
The version for Git Bash (windows). It replaces the open command and for some reason it cannot parse a nested variable modification (line 17)
.../bin/git-browse