You can strip the prefix from the variable pretty easily: ${GIT_BRANCH##origin/}
Although this is not a very general solution, it’s quite simple and I haven’t seen a repository cloned by Jenkins, which would use something else than origin
for the remote name.
Update: Actually, ${GIT_BRANCH#*/}
will work for any origin and even for branches containing slashes. The #
does non-greedy glob matching, ##
enables greedy matching. See Bash Reference Manual for details.