Skip to content

Instantly share code, notes, and snippets.

@pevers
Last active June 12, 2020 10:42
Show Gist options
  • Save pevers/4d99d3a82a4987c970db75a6f6bdb9db to your computer and use it in GitHub Desktop.
Save pevers/4d99d3a82a4987c970db75a6f6bdb9db to your computer and use it in GitHub Desktop.
#!/bin/bash
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
REPO=$(git remote get-url origin | sed -n 's/^.*:\(.*\).git$/\1/p')
TARGET_BRANCH=${1:-${GH_BRANCH:-staging}}
LINK="https://github.com/$REPO/compare/$TARGET_BRANCH...$BRANCH_NAME"
if [ -x "$(command -v xdg-open)" ]; then
xdg-open $LINK
exit 0
fi
open $LINK
@pevers
Copy link
Author

pevers commented Jun 12, 2020

.zshrc/.bashrc/.bash_profile

alias pr='sh /path_to_script/pr.sh'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment