zulip/tools/fetch-rebase-pull-request

18 lines
396 B
Bash
Executable File

#!/usr/bin/env bash
set -e
this_file=$(readlink -f "${BASH_SOURCE[0]}")
# shellcheck source=lib/git-tools.bash
. "${this_file%/*}"/lib/git-tools.bash
require_clean_work_tree 'check out PR as branch'
request_id="$1"
remote=${2:-"upstream"}
set -x
git fetch "$remote" "pull/$request_id/head"
git checkout -B "review-${request_id}" "$remote/master"
git reset --hard FETCH_HEAD
git pull --rebase