ivan_pozdeev ivan_pozdeev - 1 year ago 73
Git Question

Find the first release(s) (=tags) the commit has gone into

Once I've located some specific commit in a git repo (e.g. one that fixed some bug or introduced some feature), I'm naturally interested which releases I can find it in.

  • As a rule (=in any project worth its salt), releases are marked as tags, usually with a name along the lines of

  • Typically, only the first release matters

    • But sometimes, it may have also been backported to an earlier version line

Things I considered:

  • git describe --contains <sha1>
    - only shows the 1st tag after the commit, while I'm interested in an indefinite number of tags

  • git branch -a --contains <sha1>
    - shows branches, i.e. version lines, rather than individual releases

Showing how to also do it in GitHub and/or TortoiseGit UI, if possible, would be a plus (comment if you feel this warrants a separate question).

Answer Source

On git CLI do git tag --contains <sha1>

Go to TortoiseGit log. Right click on the on the commit and select "Show branches this commit is on" (requires TortoiseGit > 2.3 in order to see tags, enter "tags" to filter in order to only see tags).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download