13 lines
459 B
Bash
Executable file
13 lines
459 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e # bail on errors
|
|
|
|
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
REMOTE="${1:-$(git config --get branch.${CURRENT_BRANCH}.remote)}"
|
|
BRANCH="${2:-$CURRENT_BRANCH}"
|
|
REPO=$(git config --get remote.${REMOTE}.url | cut -d':' -f2 | cut -d'.' -f1)
|
|
if [[ -z "$REPO" ]] || [[ -z "$BRANCH" ]]; then
|
|
echo "usage: $(basename "$0") <remote> <branch (ref)>"
|
|
exit 1
|
|
fi
|
|
open -a "Google Chrome" "https://github.com/${REPO}/compare/${BRANCH}?expand=1"
|