Given a git commit hash, how to find out which kernel release contains it?

As mentioned on LWN, the easiest is:

git describe --contains f3a1ef9cee4812e2d08c855eb373f0d83433e34c

If you don't want a local clone, gitweb's "plain" formatted commit contains the same info in the X-Git-Tag header. Unfortunately kernel.org switched over to cgit which apparently does not disclose this information. Previously it was possible to find it out like this:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff_plain;h=f3a1ef9cee4812e2d08c855eb373f0d83433e34c

Here, X-Git-Tag is actually missing at the moment because that commit isn't in a tagged release in that repository. But you can look at an earlier commit, like:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff_plain;h=dc0827c128c0ee5a58b822b99d662b59f4b8e970

Here, you see:

X-Git-Tag: v3.4-rc1~184^2~10

which tells me that the tag "v3.4-rc1" was the first tag to follow my patch, so I'd expect to see it in v3.4.


In GitHub kernel repository, you can check all tags/kernel versions.

Example for dc0827c128c0ee5a58b822b99d662b59f4b8e970 provided by Jim Paris:

Commit dc0827c@GitHub

If three-dots are clicked, full list of tags/kernel versions can be seen.