def get_current_branch():
    with hide('running', 'stdout'):
        branch = local('git symbolic-ref -q HEAD', capture=True)

    return branch.replace('refs/heads/', '')
Uses git to return the current symbolic-ref (branch)
dataset/ETHPy150Open onefinestay/gonzo/gonzo/helpers/git.py/get_current_branch