Skip to main content

git: make alias to open github in browser

Make an alias hub for git:

git config --global alias.hub '!f() { open "$(git ls-remote --get-url $(git config --get branch.$(git branch --show-current).remote) | sed '"'"'s|git@github.com:\(.*\)$|https://github.com/\1|'"'"' | sed '"'"'s|\.git$||'"'"')/"; }; f'

So type git hub inside the repo to open it in standard browser.