Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d906a87

Browse files
authored
Merge pull request #4476 from pks-t/pks/backport-script
scripts: add backporting script
2 parents 8529ac9 + 0b3d859 commit d906a87

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

script/backport.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
if test $# -eq 0
4+
then
5+
echo "USAGE: $0 <#PR> [<#PR>...]"
6+
exit
7+
fi
8+
9+
commits=
10+
11+
for pr in $*
12+
do
13+
mergecommit=$(git rev-parse ":/Merge pull request #$pr" || exit 1)
14+
mergebase=$(git merge-base "$mergecommit"^1 "$mergecommit"^2 || exit 1)
15+
16+
commits="$commits $(git rev-list --reverse "$mergecommit"^2 ^"$mergebase")"
17+
done
18+
19+
echo "Cherry-picking the following commits:"
20+
git rev-list --no-walk --oneline $commits
21+
echo
22+
23+
git cherry-pick $commits

0 commit comments

Comments
 (0)