Skip to content

Instantly share code, notes, and snippets.

@ssokolow
Forked from ches/snippet.sh
Created June 24, 2009 04:21
Show Gist options
  • Select an option

  • Save ssokolow/135000 to your computer and use it in GitHub Desktop.

Select an option

Save ssokolow/135000 to your computer and use it in GitHub Desktop.

Revisions

  1. ssokolow revised this gist Jun 24, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snippet.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,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 -En "s/^\* //p"); if ! git ls-remote . | grep -q -e "refs/remotes/.*/${br}"; then br="master"; fi; open $(git config -l | sed -En "s%remote.origin.url=git(@|://)(github.com)(:|/)(.+/.+).git%https://\2/\4/tree/${br}%p")'
    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")'
  2. @ches ches revised this gist Apr 4, 2009. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion snippet.sh
    Original file line number Diff line number Diff line change
    @@ -1 +1,4 @@
    alias github='br=$(git branch --contains HEAD | sed -En "s/^\* //p"); open $(git config -l | sed -En "s%remote.origin.url=git(@|://)(github.com)(:|/)(.+/.+).git%https://\2/\4/tree/${br}%p")'
    # 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 -En "s/^\* //p"); if ! git ls-remote . | grep -q -e "refs/remotes/.*/${br}"; then br="master"; fi; open $(git config -l | sed -En "s%remote.origin.url=git(@|://)(github.com)(:|/)(.+/.+).git%https://\2/\4/tree/${br}%p")'
  3. @ches ches revised this gist Apr 4, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snippet.sh
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    alias github='br=$(git branch --contains HEAD | sed -En "s/^\* //p"); open $(git config -l | grep "remote.origin.url" | sed -En "s%remote.origin.url=git(@|://)(github.com)(:|/)(.+/.+).git%https://\2/\4/tree/${br}%p")'
    alias github='br=$(git branch --contains HEAD | sed -En "s/^\* //p"); open $(git config -l | sed -En "s%remote.origin.url=git(@|://)(github.com)(:|/)(.+/.+).git%https://\2/\4/tree/${br}%p")'
  4. @ches ches revised this gist Apr 4, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snippet.sh
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    alias github='br=$(git branch --contains HEAD | sed -En "s/^\* //p"); open $(git config -l | grep "remote.origin.url" | sed -En "s/remote.origin.url=git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\3\/\4\/tree\/${br}/p")'
    alias github='br=$(git branch --contains HEAD | sed -En "s/^\* //p"); open $(git config -l | grep "remote.origin.url" | sed -En "s%remote.origin.url=git(@|://)(github.com)(:|/)(.+/.+).git%https://\2/\4/tree/${br}%p")'
  5. @ches ches created this gist Apr 4, 2009.
    1 change: 1 addition & 0 deletions snippet.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    alias github='br=$(git branch --contains HEAD | sed -En "s/^\* //p"); open $(git config -l | grep "remote.origin.url" | sed -En "s/remote.origin.url=git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\3\/\4\/tree\/${br}/p")'