Skip to content

Instantly share code, notes, and snippets.

View asannikov's full-sized avatar

Anton Sannikov asannikov

  • Vienna, Austria
View GitHub Profile
@asannikov
asannikov / github.bash
Last active September 20, 2019 01:29 — forked from igrigorik/github.bash
output and open GitHub URL for current/pointed directory/file
#!/usr/bin/env bash
BASEREPO="$(git remote -v | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/git@/http:\/\//' -e's/\.git$//' | sed -E 's/(\/\/[^:]*):/\1\//')"
BASEREPO="${BASEREPO}"
CURRENTBRANCH="$(git branch | grep \* | cut -d ' ' -f2)"
CURRENTBRANCH="${CURRENTBRANCH}"
BASEPATH="$(git rev-parse --show-toplevel)"
BASEPATH="${BASEPATH}"