As seen on T413018: Parsoid tests in REL1_XX branches need updating for T407131, there is sometimes reason to run this on REL1_XX branches.
I note, in practice, the script seems to only git checkout master in case of error, and suggests console.log(' git rebase --keep-empty origin/master'); as a command to run...
But it should be possible to look at the currently checked out branch (or use the branch parameter to the script run?), and use that for the output.