-
-
Save brian-griffin/17d9e036db3d0568b63d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function github { | |
branch="$(git rev-parse --abbrev-ref HEAD)" | |
url="$(git config --get remote.origin.url)" | |
url=${url/[email protected]:/http://github.com/} | |
url=${url/.git/} | |
if [[ $1 =~ "compare" ]]; then action="compare" | |
else action="tree"; fi | |
if [[ $2 != "" ]]; then base="$2..." | |
elif [[ $1 =~ "pull" ]]; then action="pull" | |
else base=""; fi | |
url="${url}/${action}/${base}${branch}" | |
echo "Opening ${url} $(\open ${url})" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment