zulip/tools/fetch-pull-request

18 lines
367 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
set -e
if ! git diff-index --quiet HEAD; then
echo "There are uncommitted changes:"
git status --short
echo "Doing nothing to avoid losing your work."
exit 1
fi
request_id="$1"
remote=${2:-"upstream"}
set -x
git fetch "$remote" "pull/$request_id/head"
git checkout -B "review-original-${request_id}"
git reset --hard FETCH_HEAD