Skip to content

Instantly share code, notes, and snippets.

@mossheim
Last active July 22, 2018 18:40
Show Gist options
  • Save mossheim/7809f7a062362f0ea3ff1490ae12694b to your computer and use it in GitHub Desktop.
Save mossheim/7809f7a062362f0ea3ff1490ae12694b to your computer and use it in GitHub Desktop.
VER=3.10
if [[ -z "$1" ]]; then
echo "Please supply a PR number"
fi
git fetch upstream pull/$1/head:$1 || exit 1
git rebase --onto $VER develop $1 || exit 1
git push -u origin $1 || exit 1
# create pull request description file
gisturl="https://gist.github.com/brianlheim/7809f7a062362f0ea3ff1490ae12694b"
title="Rebasing #$1 onto $VER"
desc1="This is a rebase of PR #$1 onto the $VER branch"
desc2="Created via script: $gisturl"
file=tmp-hub-pr-$1
echo "$title" >$file
echo >>$file
echo "$desc1" >>$file
echo >>$file
echo "$desc2" >>$file
result=0
# submit pull request
if hub pull-request -b $VER -h $1 -F $file; then
git checkout develop || result=1
git branch -D $1 || result=1
else
result=1
fi
# delete description file
rm $file
exit $result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment