Skip to content

Instantly share code, notes, and snippets.

@ssokolow
Forked from ches/snippet.sh
Created June 24, 2009 04:21
Show Gist options
  • Save ssokolow/135000 to your computer and use it in GitHub Desktop.
Save ssokolow/135000 to your computer and use it in GitHub Desktop.
ches's github alias modified for Linux
# 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")'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment