Last Updated: February 25, 2016
·
927
· pacoguzman

Github Compare Branch

function branch_name() {
  branch_name="$(git symbolic-ref HEAD 2>/dev/null)"
  branch_name=${branch_name##refs/heads/}
  echo $branch_name
}

function gh_compare() {
  branch_name=`branch_name`
  repo=`git remote -v | grep push | grep origin | awk '{print $2}' | sed -e "s/^.*:\(.*\).git$/\1/"`
  url=https://github.com/$repo/compare/stable...$branch_name
  open -a "/Applications/Google Chrome.app" "$url";
}

// Open the compare view in GitHub of your current branch against the stable branch
$ gh_compare