summaryrefslogtreecommitdiff
path: root/other/toktok-rebase
diff options
context:
space:
mode:
Diffstat (limited to 'other/toktok-rebase')
-rw-r--r--other/toktok-rebase48
1 files changed, 48 insertions, 0 deletions
diff --git a/other/toktok-rebase b/other/toktok-rebase
new file mode 100644
index 00000000..c6f9f38a
--- /dev/null
+++ b/other/toktok-rebase
@@ -0,0 +1,48 @@
1#!/usr/bin/zsh
2
3if [[ $1 == '-v' ]]; then
4 set -u -x
5fi
6
7PREHEAD=`git rev-parse --abbrev-ref HEAD`
8TRGT=`git show-ref toktok/master --hash`
9EXCLD=`git branch --contains $TRGT`
10
11FAILED=()
12SUCCESS=()
13EXCLUDED=()
14
15echo "Auto Rebaseing!"
16git fetch --all > /dev/null 2>&1
17
18if [[ $1 == '-v' ]]; then
19 git branch --no-merged=toktok/master
20fi
21
22for i in `git branch --no-merged=toktok/master`; do
23 each=`echo $i | sed 's/*//'`
24
25 # quick exclude
26 if [[ ${EXCLD[(i)${each}]} -le ${#EXCLD} ]]; then
27 EXCLUDED+=$each
28 continue
29 fi
30
31 git checkout $each > /dev/null 2>&1
32 git rebase toktok/master > /dev/null 2>&1
33 if [[ $? != 0 ]]; then
34 git rebase --abort > /dev/null 2>&1
35 FAILED+=($each)
36 else
37 SUCCESS+=($each)
38 fi
39done
40
41echo "Was able to rebase (Don't forget to git push --force)"
42echo "\t $SUCCESS"
43echo "These branches failed"
44echo "\t $FAILED"
45echo "These branches were skipped without changes"
46echo "\t $EXCLUDED"
47
48git checkout $PREHEAD > /dev/null 2>&1