Skip to content

Commit

Permalink
Fix git rpr
Browse files Browse the repository at this point in the history
Signed-off-by: Emile Vauge <emile@vauge.com>
  • Loading branch information
emilevauge committed Feb 3, 2017
1 parent 1493a4c commit ac9cecc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions .github/rpr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

set -e # stop on error

usage="$(basename "$0") pr -- rebase a Pull Request against current branch"
usage="$(basename "$0") pr remote/branch -- rebase a Pull Request against a remote branch"

if [ "$#" -ne 1 ]; then
if [ "$#" -ne 2 ]; then
echo "Illegal number of parameters"
echo "$usage" >&2
exit 1
Expand All @@ -16,20 +16,19 @@ command -v jq >/dev/null 2>&1 || { echo "I require jq but it's not installed. A

set -x # echo on

base=$(git rev-parse --abbrev-ref HEAD)
initial=$(git rev-parse --abbrev-ref HEAD)
pr=$1
base=$2
remote=$(curl -s https://api.github.com/repos/containous/traefik/pulls/$pr | jq -r .head.repo.owner.login)
branch=$(curl -s https://api.github.com/repos/containous/traefik/pulls/$pr | jq -r .head.ref)

git checkout $base

git remote add $remote git@github.com:$remote/traefik.git
git fetch $remote $branch
git checkout -t $remote/$branch
git rebase origin/$base
git rebase $base
git push -f $remote $branch

# clean
git checkout $base
git checkout $initial
git branch -D $branch
git remote remove $remote

0 comments on commit ac9cecc

Please sign in to comment.