2

I have followed the previous post to try to find out which release contains a given git commit.

git tag --contains 8f873c1ff4ca034626093d03b254e7cb8bb782dd

It gives me a list from v3.17 to v3.19-rc7.

I also found there is another command can do this

git describe --tag 8f873c1ff4ca034626093d03b254e7cb8bb782dd

But it give me a different result, v3.16-rc5-211-g8f873c1. Notice that the previous result, v3.17 to v3.19-rc7, doesn't contain any v3.16.x version.

Acturally, I have used git checkout <tags> to manually search, then I found that the given commit was first introduced at v3.16.2.

Can anyone explain what's going on here?

Community
  • 1
  • 1
house
  • 93
  • 1
  • 7

1 Answers1

1

You're asking two different questions.

git describe --tag 8f873c1ff4ca034626093d03b254e7cb8bb782dd gives you the description of a specific commit. It starts with the given commit, then works backwards until it finds a tag and gives you an answer of the form <tag>-<count>-g<commit_id>, which tells that commit <commit_id> is <count> commits after <tag>.

git tag --contains 8f873c1ff4ca034626093d03b254e7cb8bb782dd is asking for a list of tags that contain the given commit...which means that any tag provided in the output of this command is going to be newer than the specified commit. That is, this command is searching in the opposite direction of the previous command.

So since you're asking two very different questions, you're getting two different answers.

larsks
  • 277,717
  • 41
  • 399
  • 399