From a9aa82530bfd0875abaf1310edfe3258f4cdf1e6 Mon Sep 17 00:00:00 2001 From: pancake Date: Sun, 10 Aug 2014 17:11:58 +0200 Subject: [PATCH] Add cherrypull script here --- cherrypull.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 cherrypull.sh diff --git a/cherrypull.sh b/cherrypull.sh new file mode 100755 index 00000000..247c9096 --- /dev/null +++ b/cherrypull.sh @@ -0,0 +1,28 @@ +#!/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 co -b branch +git reset --hard @~100 +git pull $RR $RB +C=`git log | grep ^commit | head -n $N | cut -d ' ' -f2` +RC="" +git co master +for a in $C ; do + RC="$a $RC" +done +for a in $RC ; do + git cherry-pick $a +done +git branch -D branch