-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Emile Vauge <emile@vauge.com>
- Loading branch information
1 parent
e20d13c
commit 4d99b84
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh | ||
# | ||
# git config --global alias.rpr '!sh .github/rpr.sh' | ||
|
||
set -e # stop on error | ||
|
||
usage="$(basename "$0") pr -- rebase a Pull Request against current branch" | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Illegal number of parameters" | ||
echo "$usage" >&2 | ||
exit 1 | ||
fi | ||
|
||
command -v jq >/dev/null 2>&1 || { echo "I require jq but it's not installed. Aborting." >&2; exit 1; } | ||
|
||
set -x # echo on | ||
|
||
base=$(git rev-parse --abbrev-ref HEAD) | ||
pr=$1 | ||
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 push -f $remote $branch | ||
|
||
# clean | ||
git checkout $base | ||
git branch -D $branch | ||
git remote remove $remote |