Skip to content

Instantly share code, notes, and snippets.

@flomotlik
Created September 28, 2016 11:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flomotlik/394f7e1a674a6cb451e2a4aecf6c6a6e to your computer and use it in GitHub Desktop.
Save flomotlik/394f7e1a674a6cb451e2a4aecf6c6a6e to your computer and use it in GitHub Desktop.
Pull Request handling
# Checkout a PR from the current repo
function copr { git fetch origin pull/$1/head:pr-$1; git checkout pr-$1; }
# Get the current PR from the branch name
function current_pr {
git rev-parse --abbrev-ref HEAD | grep -oE "\d+"
}
# Update the PR
function upr {
pr=$(current_pr)
echo "Pulling for PR: $pr"
git pull origin pull/$pr/head
}
# Open the PR in the browser
function opr {
pr=$(current_pr)
echo "Opening PR: $pr"
open "https://github.com/serverless/serverless/pull/$pr"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment