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'.
This commit is contained in:
Christie Koehler 2016-10-11 11:36:54 -07:00 committed by Tim Abbott
parent 41587edd2e
commit 24e2690ec2
2 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -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