I think this is only correct for branches with only one path segment, but for hierarchical branch names like "refs/heads/feature/xyz" it yields wrong results, for this example you would end up with mergeBranchName = "/xyz" instead of "/feature/xyz".

Also the variable name is a bit misleading as this always starts with a leading slash which isn't common for a branch name.