diff options
Diffstat (limited to 'other/toktok-rebase')
-rw-r--r-- | other/toktok-rebase | 48 |
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 | |||
3 | if [[ $1 == '-v' ]]; then | ||
4 | set -u -x | ||
5 | fi | ||
6 | |||
7 | PREHEAD=`git rev-parse --abbrev-ref HEAD` | ||
8 | TRGT=`git show-ref toktok/master --hash` | ||
9 | EXCLD=`git branch --contains $TRGT` | ||
10 | |||
11 | FAILED=() | ||
12 | SUCCESS=() | ||
13 | EXCLUDED=() | ||
14 | |||
15 | echo "Auto Rebaseing!" | ||
16 | git fetch --all > /dev/null 2>&1 | ||
17 | |||
18 | if [[ $1 == '-v' ]]; then | ||
19 | git branch --no-merged=toktok/master | ||
20 | fi | ||
21 | |||
22 | for 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 | ||
39 | done | ||
40 | |||
41 | echo "Was able to rebase (Don't forget to git push --force)" | ||
42 | echo "\t $SUCCESS" | ||
43 | echo "These branches failed" | ||
44 | echo "\t $FAILED" | ||
45 | echo "These branches were skipped without changes" | ||
46 | echo "\t $EXCLUDED" | ||
47 | |||
48 | git checkout $PREHEAD > /dev/null 2>&1 | ||