rizin/sys/cherrypull.sh
condret f4fd1e7ec6 Fix cherrypull.sh
(cherry picked from commit ee08168203ae4c2d08178e05a932613ade6489ed)
2014-08-29 16:34:11 +02:00

28 lines
437 B
Bash
Executable file

#!/bin/sh
[ "$1" = git ] && shift
[ "$1" = pull ] && shift
RR=$1
RB=$2
N=$3
if [ -z "$N" ]; then
echo "Usage: sys/cherrypull.sh [url] [branch] [ncommits]"
exit 1
fi
git branch -D branch
git checkout -b branch
git reset --hard @~100
git pull $RR $RB
C=`git log | grep ^commit | head -n $N | cut -d ' ' -f2`
RC=""
git checkout master
for a in $C ; do
RC="$a $RC"
done
for a in $RC ; do
git cherry-pick $a
done
git branch -D branch