Files
zulip/tools/fetch-rebase-pull-request
Anders Kaseorg 6a6c6d469b Rename default branch to ‘main’.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 646c04eff2)
2021-09-07 13:56:41 -07:00

18 lines
375 B
Bash
Executable File

#!/usr/bin/env bash
set -e
this_dir=${BASH_SOURCE[0]%/*}
# shellcheck source=lib/git-tools.bash
. "${this_dir}"/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/main"
git reset --hard FETCH_HEAD
git pull --rebase