Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
45 lines (37 loc) · 1.11 KB

File metadata and controls

executable file
·
45 lines (37 loc) · 1.11 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
set -u -e -o pipefail
BASEDIR=$(dirname "$0")
if [ $# -eq 0 ]; then
echo "Rebase github PR onto a branch"
echo
echo "$0 branch_to_rebase_on PR_NUMBER"
echo
exit 0
fi
REBASE_ON="$1"
PR_NO="$2"
HEAD_LABEL=`curl -s https://api.github.com/repos/angular/angular/pulls/$PR_NO | node $BASEDIR/utils/json_extract.js head.label`
echo $HEAD_LABEL
IFS=':' read -r -a array <<< "$HEAD_LABEL"
USER="${array[0]}"
USER_GIT_URL="git@github.com:$USER/angular.git"
BRANCH="${array[1]}"
OLD_BRANCH=`git branch | grep \* | cut -d ' ' -f2`
echo =====================================================
echo Rebasing $USER_GIT_URL branch $BRANCH onto $REBASE_ON
echo =====================================================
git fetch $USER_GIT_URL $BRANCH
git co FETCH_HEAD
PUSH_CMD="git push $USER_GIT_URL HEAD:$BRANCH -f";
RESTORE_CMD="git co $OLD_BRANCH"
git rebase upstream/master
if [ $? -eq 0 ]; then
$PUSH_CMD
$RESTORE_CMD
else
echo ===========================
echo Git rebase failed. RECOVER WITH:
echo " $PUSH_CMD"
echo " $RESTORE_CMD"
echo ===========================
fi
Morty Proxy This is a proxified and sanitized view of the page, visit original site.