Last active
August 29, 2015 14:08
-
-
Save jhildensperger/521e9baeff9d545113e8 to your computer and use it in GitHub Desktop.
Open current branch on github compared to master
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
# add .open-github-branch.bash to ~/ | |
# add commented code to your ~/.bash_profile | |
# restart terminal and enjoy! | |
# | |
# if [ -f ~/.open-github-branch.bash ]; then | |
# . ~/.open-github-branch.bash | |
# fi | |
# | |
# alias gpr='__open_github_branch' | |
#!/bin/bash | |
__open_github_branch() | |
{ | |
branch=$(git rev-parse --abbrev-ref HEAD) | |
remoteUrl=$(git config --get remote.origin.url) | |
remoteUrl=${remoteUrl/.git/} | |
if [[ $remoteUrl == *"git@"* ]] | |
then | |
remoteUrl=${remoteUrl/://} | |
remoteUrl=${remoteUrl/git@/https://} | |
fi | |
open $remoteUrl/compare/$branch | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment