From 24e2690ec2f0adcb220e6d2f82c28de3ce87246d Mon Sep 17 00:00:00 2001 From: Christie Koehler Date: Tue, 11 Oct 2016 11:36:54 -0700 Subject: [PATCH] tools: Improve git scripts. Minor fixes that enable the ability to: - Re-run fetch-rebase-pull-request. - Specify the name of the remote repo as an optional second parameter. The default remains 'upstream'. --- tools/fetch-rebase-pull-request | 7 ++++--- tools/reset-to-pull-request | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/fetch-rebase-pull-request b/tools/fetch-rebase-pull-request index bb484a8f7e..df1661d7f0 100755 --- a/tools/fetch-rebase-pull-request +++ b/tools/fetch-rebase-pull-request @@ -1,9 +1,10 @@ -#!/bin/sh +#!/bin/bash set -e set -x request_id="$1" -git fetch upstream "pull/$request_id/head" -git checkout upstream/master -b "review-${request_id}" +remote=${2:-"upstream"} +git fetch "$remote" "pull/$request_id/head" +git checkout -B "review-${request_id}" $remote/master git reset --hard FETCH_HEAD git pull --rebase diff --git a/tools/reset-to-pull-request b/tools/reset-to-pull-request index af8b5b11a0..7d8d69933a 100755 --- a/tools/reset-to-pull-request +++ b/tools/reset-to-pull-request @@ -1,7 +1,8 @@ -#!/bin/sh +#!/bin/bash set -e set -x request_id="$1" -git fetch upstream "pull/$request_id/head" +remote=${2:-"upstream"} +git fetch "$remote" "pull/$request_id/head" git reset --hard FETCH_HEAD