ssokolow (owner)

Fork Of

gist: 90083 by ches Bash alias to open Github p...

Revisions

gist: 135000 Download_button fork
public
Description:
ches's github alias modified for Linux
Public Clone URL: git://gist.github.com/135000.git
snippet.sh
1
2
3
4
# Bash alias to open Github page for project in current working directory.
# Will use the current active branch if it exists remotely, or falls back to master.
 
alias github='br=$(git branch --contains HEAD | sed -rn "s/^\* //p"); if ! git ls-remote . | grep -q -e "refs/remotes/.*/${br}"; then br="master"; fi; xdg-open $(git config -l | sed -rn "s%remote.origin.url=git(@|://)(github.com)(:|/)(.+/.+).git%https://\2/\4/tree/${br}%p")'