def get_last_tag_by_date(directory=None):
    cmd = "git for-each-ref --sort='*authordate' " \
          "--format='%(refname:short)' refs/tags/upstream"
    output = check_output(cmd, shell=True, cwd=directory, stderr=PIPE)
    output = output.splitlines()
    if len(output) == 0:
        return ''
    return output[-1]
Returns the most recent, by date, tag in the given local git repository.
dataset/ETHPy150Open ros-infrastructure/bloom/bloom/git.py/get_last_tag_by_date