forked from cep21/jackbash
/
git-mybase
executable file
·23 lines (22 loc) · 932 Bytes
/
git-mybase
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# A pretty looking git-svn-rebase that is way better than the default
# TODO: Make this work for non-SVN repositories
GROUP_VERSION="$HOME/.bash/group/bin/git-mybase"
if [ -f $GROUP_VERSION ]; then
source $GROUP_VERSION
exit
fi;
SVN_REF=`git config svn-remote.svn.fetch | sed s/.*://`
OLD_SVN=`git rev-parse $SVN_REF`
CUR_BRANCH=`git status | grep -P '^# On branch' | sed 's/# On branch //'`
git svn fetch > /dev/null
git rebase $SVN_REF > /dev/null
# Lol xargs and && is crazy
# Use this if you want to rebase every branch when you rebase
#git branch --no-abbrev -v --no-color | sed 's/[ *]*//' | cut -d' ' -f1 | xargs -i echo "git checkout -q {} && git rebase $SVN_REF" | sh > /dev/null
REBASE_RETURN_CODE="$?"
git checkout -q $CUR_BRANCH
git log $OLD_SVN..$SVN_REF --stat=80,120 --pretty=format:'%Cred%an%Creset %Cgreen%H%Creset %s'
# You need gcbr as defined my my .gitconfig
git gcbr
exit $REBASE_RETURN_CODE