extract right branch name on rebase

probably should switch to python :-)

close #326