def get_branch_name(ref_name):
    branch_ref_prefix = 'refs/heads/'

    if ref_name.startswith(branch_ref_prefix):
        return ref_name[len(branch_ref_prefix):]
Returns the branch name corresponding to the specified ref name.
dataset/ETHPy150Open reviewboard/rbtools/rbtools/hooks/git.py/get_branch_name