The following git aliases help you to easily checkout and update pull requests.
The main commands git pr [id] [remote?]
and git prc
were taken from from this gist, so all credits for the original git aliases go to the author.
Note, the question mark indicates optional parameters.
However, I have added a new command git pru [remote?]
which lets you update a PR. You can also do this by calling git pr [id]
again but to make this more convenient I have implemented an alias that uses the original command and parses the current branch name to automatically pass along the PR id. If you are not currently on a branch that starts with pr/
you'll get an error.
// Checkout PR with id 123, assuming the remote is origin
git pr 123
// Author of the PR has pushed some updates so we want to update our PR branch accordingly
git pru