Search code examples
gitgithubwindow

Git how to check what are all the tags in current changeset


In my remote github repository there can be multiple tags created for one change set. After I clone the github repository to local how can I check what are all the tags in the latest change set

git describe --abbrev=0 --tags only passes the latest tag in the latest change set. But I want to get all the tags in current change-set.


Solution

  • One quick option would be:

    git log -1 --decorate=on
    

    It will show you all tags pointing to the latest commit. Example:

    commit f05c2e0b8 (HEAD -> master, tag: foo, tag: bar)
    

    You could also pipe the output through grep to see the tag names only:

    git log -1 --pretty=%d | grep -oP '(?<=tag: )[^,^)]+'
    

    Result:

    foo
    bar