extract getting branch name to function