Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
git alias to push and open PR view
# Pushes to origin and opens a github compare view of it to speed up PR
# creation.
# To install add to $PATH with executable permission and run
# git config --global '!github-push-pr'
branch=$(git symbolic-ref --short HEAD)
# -> foo/bar
repo=$(git ls-remote --get-url ${remote} \
| sed 's|^.*[:/]\(.*\)$|\1|' \
| sed 's|\(.*\)/$|\1|' \
| sed 's|\(.*\)\(\.git\)|\1|')
set -x
git push ${remote} ${branch}
open "${repo}/compare/${branch}?expand=1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment